github.com/NeowayLabs/nash@v0.2.2-0.20200127205349-a227041ffd50/tests/internal/assert/equal.go (about) 1 package assert 2 3 import ( 4 "strings" 5 "testing" 6 ) 7 8 func EqualStrings(t *testing.T, want string, got string) { 9 // TODO: could use t.Helper here, but only on Go 1.9 10 if want != got { 11 t.Fatalf("wanted[%s] but got[%s]", want, got) 12 } 13 } 14 15 func ContainsString(t *testing.T, str string, sub string) { 16 // TODO: could use t.Helper here, but only on Go 1.9 17 if !strings.Contains(str, sub) { 18 t.Fatalf("[%s] is not a substring of [%s]", sub, str) 19 } 20 }