feat: Adding test to main.go

This commit is contained in:
Marcell Martini 2020-12-27 18:21:02 -04:00
parent 08fdacc082
commit a4d13ad0ed

42
cmd/echoip/main_test.go Normal file
View File

@ -0,0 +1,42 @@
package main
import "testing"
func TestMultiValueFlagString(t *testing.T) {
var xmvf = []struct {
values multiValueFlag
expect string
}{
{
values: multiValueFlag{
"test",
"with multiples",
"flags",
},
expect: `test, with multiples, flags`,
},
{
values: multiValueFlag{
"test",
},
expect: `test`,
},
{
values: multiValueFlag{
"",
},
expect: ``,
},
{
values: nil,
expect: ``,
},
}
for _, mvf := range xmvf {
got := mvf.values.String()
if got != mvf.expect {
t.Errorf("\nFor: %#v\nExpected: %v\nGot: %v", mvf.values, mvf.expect, got)
}
}
}