bb/lib/common_test.go
Ryan Cavicchioni 579921a975
Some checks failed
continuous-integration/drone/push Build is failing
s/HasCommand/ContainsCommand/g
2022-09-05 12:54:56 -05:00

29 lines
602 B
Go

package lib
import "testing"
func TestContainsCommand(t *testing.T) {
tables := []struct {
s string
prefix string
cmd string
r bool
}{
{"!command x y", "!", "command", true},
{"#command x y", "#", "command", true},
{"command x y", "!", "comamnd", false},
{"", "", "", false},
{"!", "!", "", false},
{"! x y", "!", "", false},
}
for _, table := range tables {
r := ContainsCommand(table.s, table.prefix, table.cmd)
if r != table.r {
t.Errorf("ContainsCommand(%q, %q, %q), got: %t, want: %t",
table.s, table.prefix, table.cmd, r, table.r,
)
}
}
}