package lib import ( "testing" "git.ymnuktech.ru/ymnuk/yt-gen-app/structs" ) func TestFieldType(t *testing.T) { if fieldDBName(&structs.Field{Name: "Field"}) != "field" { t.Fail() } if fieldDBName(&structs.Field{Name: "Field_NAME"}) != "field_name" { t.Fail() } if fieldDBName(&structs.Field{Name: "fIELD_nAMe"}) != "field_name" { t.Fail() } } func TestDBModelAttrib(t *testing.T) { str := fieldDescript(&structs.Field{ Name: "Field_naME1", Type: "int", Description: "Hello world", }) if str != "`gorm:\"column:field_name1;type:INT;comment:Hello world\"`" { t.Fail() } }