Skip to content

Commit

Permalink
Add common Initialism test. #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Shelnutt2 committed Jun 7, 2016
1 parent d230ec3 commit 577e442
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,43 @@ type testStruct struct {
So(string(bytes), ShouldEqual, expectedStruct)
})
}

func TestMysqlStringWithUnderscoresGenerate(t *testing.T) {
expectedStruct :=
`package test
type testStruct struct {
StringColumn string
}
`

columnMap := map[string]map[string]string{
"string_Column": {"nullable": "NO", "value": "varchar"},
}
bytes, err := Generate(columnMap, "testStruct", "test", false, false)

Convey("Should be able to generate map from string column", t, func() {
So(err, ShouldBeNil)
So(string(bytes), ShouldEqual, expectedStruct)
})
}

func TestMysqlStringWithCommonInitialismGenerate(t *testing.T) {
expectedStruct :=
`package test
type testStruct struct {
API string
}
`

columnMap := map[string]map[string]string{
"API": {"nullable": "NO", "value": "varchar"},
}
bytes, err := Generate(columnMap, "testStruct", "test", false, false)

Convey("Should be able to generate map from string column", t, func() {
So(err, ShouldBeNil)
So(string(bytes), ShouldEqual, expectedStruct)
})
}

0 comments on commit 577e442

Please sign in to comment.