2016-03-04 05:14:55 -05:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
2016-03-10 20:46:22 -05:00
|
|
|
// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
|
2016-03-04 05:14:55 -05:00
|
|
|
|
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGlueStrings(t *testing.T) {
|
|
|
|
cases := []struct{ a, b, expected string }{
|
|
|
|
{
|
|
|
|
"Some log that starts in a",
|
|
|
|
"starts in a, but continues in b",
|
|
|
|
"Some log that starts in a, but continues in b",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"",
|
|
|
|
"starts in b",
|
|
|
|
"starts in b",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, testcase := range cases {
|
|
|
|
t.Logf("testcase: %+v\n", testcase)
|
|
|
|
|
|
|
|
result := GlueStrings(testcase.a, testcase.b)
|
|
|
|
t.Logf("result: '%s'", result)
|
|
|
|
|
|
|
|
if result != testcase.expected {
|
|
|
|
t.Errorf("expected %q, got %q", testcase.expected, result)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|