github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/go-xorm/core/mapper_test.go (about) 1 package core 2 3 import ( 4 "testing" 5 ) 6 7 func TestGonicMapperFromObj(t *testing.T) { 8 testCases := map[string]string{ 9 "HTTPLib": "http_lib", 10 "id": "id", 11 "ID": "id", 12 "IDa": "i_da", 13 "iDa": "i_da", 14 "IDAa": "id_aa", 15 "aID": "a_id", 16 "aaID": "aa_id", 17 "aaaID": "aaa_id", 18 "MyREalFunkYLONgNAME": "my_r_eal_funk_ylo_ng_name", 19 } 20 21 for in, expected := range testCases { 22 out := gonicCasedName(in) 23 if out != expected { 24 t.Errorf("Given %s, expected %s but got %s", in, expected, out) 25 } 26 } 27 } 28 29 func TestGonicMapperToObj(t *testing.T) { 30 testCases := map[string]string{ 31 "http_lib": "HTTPLib", 32 "id": "ID", 33 "ida": "Ida", 34 "id_aa": "IDAa", 35 "aa_id": "AaID", 36 "my_r_eal_funk_ylo_ng_name": "MyREalFunkYloNgName", 37 } 38 39 for in, expected := range testCases { 40 out := LintGonicMapper.Table2Obj(in) 41 if out != expected { 42 t.Errorf("Given %s, expected %s but got %s", in, expected, out) 43 } 44 } 45 }