shad-go/varjoin/join_test.go

36 lines
539 B
Go
Raw Normal View History

2020-02-24 19:54:48 +00:00
package varjoin
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestFormat(t *testing.T) {
for _, tc := range []struct {
sep string
args []string
result string
}{
{
sep: "/",
args: []string{},
result: "",
},
{
sep: "/",
args: []string{"1", "2", "3"},
result: "1/2/3",
},
{
sep: "",
args: []string{"h", "e", "ll", "o"},
result: "hello",
},
} {
t.Run(tc.result, func(t *testing.T) {
require.Equal(t, tc.result, Join(tc.sep, tc.args...))
})
}
}