github.phpd.cn/hashicorp/packer@v1.3.2/builder/azure/common/gluestrings_test.go (about) 1 package common 2 3 import ( 4 "testing" 5 ) 6 7 func TestGlueStrings(t *testing.T) { 8 cases := []struct{ a, b, expected string }{ 9 { 10 "Some log that starts in a", 11 "starts in a, but continues in b", 12 "Some log that starts in a, but continues in b", 13 }, 14 { 15 "", 16 "starts in b", 17 "starts in b", 18 }, 19 } 20 for _, testcase := range cases { 21 t.Logf("testcase: %+v\n", testcase) 22 23 result := GlueStrings(testcase.a, testcase.b) 24 t.Logf("result: '%s'", result) 25 26 if result != testcase.expected { 27 t.Errorf("expected %q, got %q", testcase.expected, result) 28 } 29 } 30 }