github.com/golazy/golazy@v0.0.7-0.20221012133820-968fe65a0b65/lazysupport/sentence_test.go (about) 1 package lazysupport 2 3 import "testing" 4 5 func TestToSentence(t *testing.T) { 6 7 test := func(expectation, last_join string, s ...string) { 8 t.Helper() 9 out := ToSentence(last_join, s...) 10 if out != expectation { 11 t.Errorf("Expecting %q Got %q", expectation, out) 12 } 13 } 14 15 test("", "") 16 test("uno", "", "uno") 17 test("uno y dos", "y", "uno", "dos") 18 test("one, two and three", "", "one", "two", "three") 19 20 }