Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Add go unit test + fix trailing slash bug #168

Merged
merged 1 commit into from
Oct 24, 2017

Conversation

lukebjerring
Copy link
Collaborator

No description provided.

Copy link
Contributor

@jeffcarp jeffcarp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhhhh oops I'm sorry I forgot to submit my drafts

install: go get -u github.com/golang/lint/golint
script: $GOPATH/bin/golint -set_exit_status
install:
- go get -t ./...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iiuc this installs all modules mentioned in import statements?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iiuc, yes (and according to the logs/successful build, it works)
https://travis-ci.org/w3c/wptdashboard/builds/290183421

"appengine"
"appengine/datastore"
"google.golang.org/appengine"
"google.golang.org/appengine/datastore"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested these locally? I have an unsubstantiated feeling that AE might not like these domains, but we'll see when we try pushing this to prod.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, running locally works fine.

const resultsURL = resultsURLBase + "/" + platform + "-summary.json.gz"

func TestGetResultsURL_NoTestFile(t *testing.T) {
checkResult(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the indentation got weirded out here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - Editor settings fixed, sorry about that.

emptyTestFile := ""
checkResult(
t,
Case {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also might have some indentation shenanigans here


func checkResult(t *testing.T, c Case) {
got := getResultsURL(c.testRun, c.testFile)
if got != c.expected {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no standard Golang assertion library?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I could find. There is https://github.com/stretchr/testify if we want to hook into it.

@jeffcarp jeffcarp merged commit 17184e7 into web-platform-tests:master Oct 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants