github.com/chrislusf/greenpack@v3.7.1-0.20170911073826-ad5bd10b7c47+incompatible/cmd/addzid/old_bambam_tests/capidtag_test.go (about) 1 package main 2 3 import ( 4 "testing" 5 6 cv "github.com/glycerine/goconvey/convey" 7 ) 8 9 func TestZidTagOrderAssignment(t *testing.T) { 10 11 cv.Convey("Given zid tag requests for field numbering", t, func() { 12 cv.Convey("then when assigning field numbers in the capnproto struct schema, assign zids first, then proceed in order of field appearance", func() { 13 14 ex0 := "type Z struct { A int `zid:\"2\"`; B int `zid:\"0\"`; C int `zid:\"1\"` }" 15 cv.So(ExtractString2String(ex0), ShouldStartWithModuloWhiteSpace, `struct ZCapn { b @0: Int64; c @1: Int64; a @2: Int64; } `) 16 17 ex1 := "type Z struct { A int `zid:\"1\"`; B int; C int `zid:\"0\"` }" 18 cv.So(ExtractString2String(ex1), ShouldStartWithModuloWhiteSpace, `struct ZCapn { c @0: Int64; a @1: Int64; b @2: Int64; } `) 19 20 }) 21 22 }) 23 }