Skip to content

Instantly share code, notes, and snippets.

@jochasinga
Last active April 5, 2016 16:30
Show Gist options
  • Save jochasinga/1db67ea64d76f8f0706374adb2120a57 to your computer and use it in GitHub Desktop.
Save jochasinga/1db67ea64d76f8f0706374adb2120a57 to your computer and use it in GitHub Desktop.
Simple test example in Goconvey
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func IncrementInt(i int) int {
return i + 1
}
func MyTest(t *testing.T) {
Convey("GIVEN the value of `a` is 3", t, func() {
a := 3
Convey("WITH `IncrementInt(a)`", func() {
result := IncrementInt(a)
Convey("EXPECT `a` to be incremented by 1", func() {
So(result, ShouldEqual, 4)
})
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment