summaryrefslogtreecommitdiff
path: root/src/pkg/bytes/bytes_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/bytes/bytes_test.go')
-rw-r--r--src/pkg/bytes/bytes_test.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pkg/bytes/bytes_test.go b/src/pkg/bytes/bytes_test.go
index df55ce3cc..139404421 100644
--- a/src/pkg/bytes/bytes_test.go
+++ b/src/pkg/bytes/bytes_test.go
@@ -119,6 +119,7 @@ var indexAnyTests = []BinOpTest{
BinOpTest{"aaa", "a", 0},
BinOpTest{"abc", "xyz", -1},
BinOpTest{"abc", "xcz", 2},
+ BinOpTest{"ab☺c", "x☺yz", 2},
BinOpTest{"aRegExp*", ".(|)*+?^$[]", 7},
BinOpTest{dots + dots + dots, " ", -1},
}
@@ -138,7 +139,15 @@ func runIndexTests(t *testing.T, f func(s, sep []byte) int, funcName string, tes
func TestIndex(t *testing.T) { runIndexTests(t, Index, "Index", indexTests) }
func TestLastIndex(t *testing.T) { runIndexTests(t, LastIndex, "LastIndex", lastIndexTests) }
-func TestIndexAny(t *testing.T) { runIndexTests(t, IndexAny, "IndexAny", indexAnyTests) }
+func TestIndexAny(t *testing.T) {
+ for _, test := range indexAnyTests {
+ a := []byte(test.a)
+ actual := IndexAny(a, test.b)
+ if actual != test.i {
+ t.Errorf("IndexAny(%q,%q) = %v; want %v", a, test.b, actual, test.i)
+ }
+ }
+}
func TestIndexByte(t *testing.T) {
for _, tt := range indexTests {