github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/codegen/loaderx/utils_test.go (about) 1 package loaderx 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestGetPkgImportPathAndExpose(t *testing.T) { 10 tt := assert.New(t) 11 12 cases := []struct { 13 p string 14 e string 15 s string 16 }{ 17 { 18 "a", 19 "B", 20 "a.B", 21 }, 22 { 23 "a.b.c.d/c", 24 "B", 25 "a.b.c.d/c.B", 26 }, 27 } 28 29 for _, caseItem := range cases { 30 p, e := GetPkgImportPathAndExpose(caseItem.s) 31 tt.Equal(caseItem.p, p) 32 tt.Equal(caseItem.e, e) 33 } 34 }