ch14.5
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package assert
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Equal[T comparable](t *testing.T, actual, expected T) {
|
||||
t.Helper()
|
||||
@@ -9,3 +12,11 @@ func Equal[T comparable](t *testing.T, actual, expected T) {
|
||||
t.Errorf("got: %v; want: %v", actual, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func StringContains(t *testing.T, actual, expectedString string) {
|
||||
t.Helper()
|
||||
|
||||
if !strings.Contains(actual, expectedString) {
|
||||
t.Errorf("got: %q; expected to contain: %q", actual, expectedString)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user