github.com/chrislusf/greenpack@v3.7.1-0.20170911073826-ad5bd10b7c47+incompatible/cmd/addzid/old_bambam_tests/under_test.go (about)

     1  package main
     2  
     3  import (
     4  	"testing"
     5  
     6  	cv "github.com/glycerine/goconvey/convey"
     7  )
     8  
     9  func TestUnderScoreFieldNamesRenamed(t *testing.T) {
    10  
    11  	cv.Convey("underToCamelCase should remove underscores and leave camelCase", t, func() {
    12  		cv.So(underToCamelCase(`one_two`), cv.ShouldEqual, `oneTwo`)
    13  		cv.So(underToCamelCase(`one__two`), cv.ShouldEqual, `oneTwo`)
    14  	})
    15  
    16  	cv.Convey("Given a struct that contains fields with underscores", t, func() {
    17  		cv.Convey("then these field names should be camel cased", func() {
    18  
    19  			ex0 := `
    20  type s1 struct {
    21    Hello_world int
    22  }`
    23  			cv.So(ExtractString2String(ex0), ShouldStartWithModuloWhiteSpace, `struct S1Capn { helloWorld @0: Int64; } `)
    24  		})
    25  	})
    26  }