Commit 961c31a7 by bergquist

test(util): add unit test for string util

parent d1a345bb
......@@ -10,9 +10,9 @@ func StringsFallback3(val1 string, val2 string, val3 string) string {
func stringsFallback(vals ...string) string {
for _, v := range vals {
if v != "" {
return v
}
if v != "" {
return v
}
}
return ""
}
package util
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestStringsUtil(t *testing.T) {
Convey("Falling back until none empty string", t, func() {
So(StringsFallback2("1", "2"), ShouldEqual, "1")
So(StringsFallback2("", "2"), ShouldEqual, "2")
So(StringsFallback3("", "", "3"), ShouldEqual, "3")
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment