github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/builder/azure/common/gluestrings_test.go (about) 1 // Copyright (c) Microsoft Corporation. All rights reserved. 2 // Licensed under the MIT License. See the LICENSE file in builder/azure for license information. 3 4 package common 5 6 import ( 7 "testing" 8 ) 9 10 func TestGlueStrings(t *testing.T) { 11 cases := []struct{ a, b, expected string }{ 12 { 13 "Some log that starts in a", 14 "starts in a, but continues in b", 15 "Some log that starts in a, but continues in b", 16 }, 17 { 18 "", 19 "starts in b", 20 "starts in b", 21 }, 22 } 23 for _, testcase := range cases { 24 t.Logf("testcase: %+v\n", testcase) 25 26 result := GlueStrings(testcase.a, testcase.b) 27 t.Logf("result: '%s'", result) 28 29 if result != testcase.expected { 30 t.Errorf("expected %q, got %q", testcase.expected, result) 31 } 32 } 33 }