Created
September 28, 2016 02:14
-
-
Save benjic/956cc4b7bd50d4b5f7dc229b73a7b1ae to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package add | |
func Add(a, b int) int { | |
return a + b | |
} |
This file contains hidden or 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
package add | |
import "testing" | |
func TestAdd(t *testing.T) { | |
t.Run("should add 1 and 1", func(t *testing.T) { | |
got := Add(1, 1) | |
if got != 2 { | |
t.Error("Did not get right sum") | |
} | |
}) | |
t.Run("should add 1 and 2", func(t *testing.T) { | |
got := Add(1, 2) | |
if got != 3 { | |
t.Error("Did not get right sum") | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am currently running go 1.7.1.
Running the test functions as expected.
Running the tests with the verbose flag works as expected.