-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move simple fetch tests to "go test"
- Loading branch information
Showing
9 changed files
with
66 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,3 @@ jobs: | |
go-version: 1.17 | ||
- run: | | ||
make test | ||
make testrun > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,19 @@ | ||
HN_URL := 'https://news.ycombinator.com/item?id=3078128' | ||
TW_URL := 'https://twitter.com/TwitterDev/status/1443269993676763138' | ||
GO_FILES = $(shell find . -type f -name '*.go') | ||
|
||
.PHONY: all install clean test testrun | ||
|
||
all: twitterview hackerview redditview | ||
|
||
hackerview: $(GO_FILES) | ||
go build -race -v -ldflags="-s -w" ./cmd/$@ | ||
ls -lh $@ | ||
|
||
hackerview: | ||
redditview: | ||
twitterview: $(GO_FILES) | ||
go build -v -ldflags="-s -w" ./cmd/$@ | ||
ls -lh $@ | ||
|
||
redditview: $(GO_FILES) | ||
go build -v -ldflags="-s -w" ./cmd/$@ | ||
ls -lh $@ | ||
|
||
install: hackerview twitterview redditview | ||
mv hackerview $(HOME)/go/bin/ | ||
mv twitterview $(HOME)/go/bin/ | ||
mv redditview $(HOME)/go/bin/ | ||
mv redditview $(HOME)/go/bin/ | ||
|
||
clean: ; go clean -x ./... | ||
test: ; go test -vet=all -v ./... | ||
|
||
testrun: | ||
go run cmd/hackerview/main.go -l 10 -t 20s $(HN_URL) | ||
go run cmd/twitterview/main.go -t 20s $(TW_URL) | ||
test: ; go test -vet=all -v -race ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package fetch | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
const URL = `https://www.google.com/robots.txt` | ||
|
||
func TestFech(t *testing.T) { | ||
_, err := Fetch(URL, "Wget", time.Second*10) | ||
if err != nil { | ||
t.Fail() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package hackernews | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
const URL = `https://news.ycombinator.com/item?id=3078128` | ||
|
||
func TestHNFetch(t *testing.T) { | ||
_, _, err := Fetch(URL, time.Second*10, 10, 2) | ||
if err != nil { | ||
t.Fail() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package reddit | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
const URL = `https://old.reddit.com/r/gamedev/comments/horm1a/ive_started_making_a_teaching_aid_for_people/` | ||
|
||
func TestRTFetch(t *testing.T) { | ||
_, err := Fetch(URL, "Reddit_Cli/0.1", time.Second*10) | ||
if err != nil { | ||
t.Fail() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package twitter | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
const URL = `https://twitter.com/TwitterDev/status/1443269993676763138` | ||
|
||
func TestTWFetch(t *testing.T) { | ||
_, err := Fetch(URL, "Twitter_View/0.1", time.Second*10) | ||
if err != nil { | ||
t.Fail() | ||
} | ||
} |