Last active
August 3, 2019 05:47
-
-
Save ReSTARTR/8922293c9205ea836144040c748a7130 to your computer and use it in GitHub Desktop.
Conventions in Go's Table Driven Tests
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
func TestFoo(t *testing.T) { | |
tests := []struct { | |
in string | |
out string | |
}{ | |
{in: "foo", out: "FOO"}, | |
} | |
for _, tt := range tests { | |
got := Foo(tt.in) | |
if got != tt.out { | |
t.Errorf("got: %s; want: %s", got, tt.out) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment