You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
884 B
Go
47 lines
884 B
Go
// +build convey
|
|
|
|
package incr
|
|
|
|
import (
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
"testing"
|
|
)
|
|
|
|
func TestOnce(t *testing.T) {
|
|
Convey("Given some integer with a starting value", t, func() {
|
|
x := 1
|
|
|
|
Convey("When the integer is incremented", func() {
|
|
x++
|
|
|
|
Convey("The value should be greater by one", func() {
|
|
So(x, ShouldEqual, 2)
|
|
})
|
|
})
|
|
})
|
|
}
|
|
|
|
func TestTwice(t *testing.T) {
|
|
Convey("Given some integer with a starting value", t, func() {
|
|
x := 1
|
|
|
|
Convey("When the integer is incremented", func() {
|
|
x++
|
|
|
|
Convey("The value should be greater by one", func() {
|
|
So(x, ShouldEqual, 2)
|
|
})
|
|
})
|
|
|
|
// the name has to be updated, if you try to use the name twice, Convey
|
|
// explodes.
|
|
Convey("When the integer is incremented again", func() {
|
|
x++
|
|
|
|
Convey("The value should be greater by one", func() {
|
|
So(x, ShouldEqual, 2)
|
|
})
|
|
})
|
|
})
|
|
}
|