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

Inconsistency in Maps chapter #290

Closed
enolgor opened this issue Nov 7, 2019 · 1 comment
Closed

Inconsistency in Maps chapter #290

enolgor opened this issue Nov 7, 2019 · 1 comment

Comments

@enolgor
Copy link

enolgor commented Nov 7, 2019

If you follow the maps chapter, there is a point where you are stuck in an error not addressed in the tutorial.
After you write the TestAdd test the second time: https://github.com/quii/learn-go-with-tests/blob/master/maps.md#write-the-test-first-3

this test checks if an existing word is being added again, if it is a new word it should return a nil error, in order to check that the following call to an assertion function is made:

assertError(t, err, nil)

That function is previously written as:

func assertError(t *testing.T, got, want error) {
    t.Helper()

    if got == nil {
        t.Fatal("expected to get an error.")
    }
    
    if got != want {
        t.Errorf("got error %q want %q", got, want)
    }
}

which will always throw a fatal error since we are passing nil as the got parameter.

@cassamajor
Copy link

This was also reported in #308 and resolved in commit a8c8a66.

@quii, you can close this issue.

@quii quii closed this as completed Jan 31, 2022
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

No branches or pull requests

3 participants