Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accumulate: update tests #567

Merged
merged 1 commit into from
Mar 6, 2017
Merged

Conversation

robphoenix
Copy link
Contributor

see #414
Also removed unnecessary else block

@robphoenix
Copy link
Contributor Author

I realise there is a question mark over the status of accumulate at the moment (#555) but I just wanted to be able to close #414

@@ -38,9 +38,7 @@ func TestAccumulate(t *testing.T) {
for _, test := range tests {
actual := Accumulate(test.given, test.converter)
if fmt.Sprintf("%s", actual) != fmt.Sprintf("%s", test.expected) {
Copy link
Member

Choose a reason for hiding this comment

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

I might say we have to use %q here too, otherwise for the first test (expects an empty list) someone could pass by emitting a list of many empty strings (not that I expect anyone to do that, but for completeness...?)

Or can switch to reflect.DeepEqual I suppose?

Copy link
Member

Choose a reason for hiding this comment

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

Ah I'm wrong, many empty strings expands to [ ] which is different from []. So I guess the risk is someone might say ["echo echo echo echo"] instead of ["echo", "echo", "echo", "echo"]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, yes, that is possible.

see exercism#414
Also removed unnecessary else block
@robphoenix
Copy link
Contributor Author

now:

--- FAIL: TestAccumulate (0.00s)
	accumulate_test.go:41: Accumulate(["echo" "echo" "echo" "echo"], "echo"): expected ["echo" "echo" "echo" "echo"], actual ["echo echo echo echo"]

@robphoenix robphoenix merged commit 2546e42 into exercism:master Mar 6, 2017
@robphoenix robphoenix deleted the update/accumulate branch March 6, 2017 10:42
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