Skip to content

Add "counter", a write-the-test-suite exercise#168

Merged
kytrinyx merged 2 commits intoexercism:masterfrom
pminten:counter
Jul 11, 2015
Merged

Add "counter", a write-the-test-suite exercise#168
kytrinyx merged 2 commits intoexercism:masterfrom
pminten:counter

Conversation

@pminten
Copy link
Copy Markdown
Contributor

@pminten pminten commented Apr 25, 2015

I'm a bit worried about the exercism cli tool here. I seem to recall that it stops the user accidentally submitting the test file, but in this case the file with the "_test.go" name is the submission.

@kytrinyx
Copy link
Copy Markdown
Member

Hm. Yepp, that's still the case:

$ exercism submit hamming_test.rb 
2015/04/25 18:43:43 Please submit the solution, not the test file.

Maybe we should just take the feature out. Are we being too helpful? When we added that feature we didn't have the "delete submission" feature, but now that's not an issue.

@pminten
Copy link
Copy Markdown
Contributor Author

pminten commented Apr 25, 2015

We could replace it with a message saying "You're submitting a test file. If this is not what you want you can delete it in this way ...". That's still fairly helpful.

@kytrinyx
Copy link
Copy Markdown
Member

Agreed. I like leaving the responsibility to the user rather than trying to be overly helpful.

@kytrinyx
Copy link
Copy Markdown
Member

The --test behavior is now available in the CLI.

I looked through this again, and the only question I have is whether we should name the test file example_test.go rather than example.go.

@pminten
Copy link
Copy Markdown
Contributor Author

pminten commented May 11, 2015

I believe I went with example_test.go because without the _test.go suffix go test won't run the tests in it.

@kytrinyx
Copy link
Copy Markdown
Member

The current file name is example.go, but it has tests in it. (Sorry, I might be misunderstanding your comment).

Comment thread counter/example.go
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we rename the file to example_test.go?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Doesn't that automatically include it in the files sent to the user?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, anything with example in the path (not just the name of the file) will be excluded from the payload to the user.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After trying this I remembered why it doesn't work. The example_test.go gets picked up by go test in the travis and fails since you have to explicitly set an environment variable to choose an implementation to test with.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, right. Yepp, that makes sense! Would you add a comment to that effect in the file itself? I can see myself forgetting this and going through the exact same set of questions six months from now.

@pminten
Copy link
Copy Markdown
Contributor Author

pminten commented Jul 11, 2015

Added explanation and rebased.

kytrinyx added a commit that referenced this pull request Jul 11, 2015
Add "counter", a write-the-test-suite exercise
@kytrinyx kytrinyx merged commit f240c7b into exercism:master Jul 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants