github.com/nibnait/go-learn@v0.0.0-20220227013611-dfa47ea6d2da/src/test/chapter/ch5/38_bdd/bdd_spec_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/smartystreets/goconvey/convey"
     7  )
     8  
     9  func TestSpec(t *testing.T) {
    10  
    11  	// Only pass t into top-level Convey calls
    12  	Convey("Given 2 even numbers", t, func() {
    13  		a := 3
    14  		b := 4
    15  
    16  		Convey("When add the two numbers", func() {
    17  			c := a + b
    18  
    19  			Convey("Then the result is still even", func() {
    20  				So(c%2, ShouldEqual, 0)
    21  			})
    22  		})
    23  	})
    24  }