github.com/glycerine/zebrapack@v4.1.1-0.20181107023619-e955d028f9bf+incompatible/cmd/addzid/time_test.go (about)

     1  package main
     2  
     3  import (
     4  	"testing"
     5  	"time"
     6  
     7  	cv "github.com/glycerine/goconvey/convey"
     8  )
     9  
    10  // run 'addzid -unexported' to see zid being added.
    11  type unused struct {
    12  	tm time.Time
    13  }
    14  
    15  func Test909TimeFieldsAddZid(t *testing.T) {
    16  
    17  	cv.Convey("Given go: type HasTime struct { A time.Time; B int  } ", t, func() {
    18  		cv.Convey("then addzid should add a zid for both the time.Time and the int field.", func() {
    19  			in1 := "type HasTime struct { A time.Time; B int; } "
    20  			ex1 := "package main type HasTime struct { A time.Time `zid:\"0\"` B int `zid:\"1\"`}"
    21  			added := ExtractStringAddZid(in1)
    22  			//p("added='%v'", added)
    23  			cv.So(added, ShouldStartWithModuloWhiteSpace, ex1)
    24  		})
    25  	})
    26  }