aboutsummaryrefslogtreecommitdiff
path: root/src/fmt
diff options
context:
space:
mode:
authorNathan VanBenschoten <nvanbenschoten@gmail.com>2015-12-22 02:40:47 -0500
committerRuss Cox <rsc@golang.org>2016-02-19 01:06:05 +0000
commitb04f3b06ec347543b0eafe82dcfb0e05885d3feb (patch)
treec9d889546ef895fce8b8a2c04c7e06cc998c1842 /src/fmt
parent952c2fd606fad19b930937ca0d5c5571d7f5d4cb (diff)
downloadgo-b04f3b06ec347543b0eafe82dcfb0e05885d3feb.tar.xz
all: replace strings.Index with strings.Contains where possible
Change-Id: Ia613f1c37bfce800ece0533a5326fca91d99a66a Reviewed-on: https://go-review.googlesource.com/18120 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/fmt')
-rw-r--r--src/fmt/scan_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fmt/scan_test.go b/src/fmt/scan_test.go
index 7ac74dcb4b..ce6f08659a 100644
--- a/src/fmt/scan_test.go
+++ b/src/fmt/scan_test.go
@@ -519,7 +519,7 @@ func testScanfMulti(name string, t *testing.T) {
if err != nil {
if test.err == "" {
t.Errorf("got error scanning (%q, %q): %q", test.format, test.text, err)
- } else if strings.Index(err.Error(), test.err) < 0 {
+ } else if !strings.Contains(err.Error(), test.err) {
t.Errorf("got wrong error scanning (%q, %q): %q; expected %q", test.format, test.text, err, test.err)
}
continue
@@ -613,7 +613,7 @@ func TestScanNotPointer(t *testing.T) {
_, err := Fscan(r, a)
if err == nil {
t.Error("expected error scanning non-pointer")
- } else if strings.Index(err.Error(), "pointer") < 0 {
+ } else if !strings.Contains(err.Error(), "pointer") {
t.Errorf("expected pointer error scanning non-pointer, got: %s", err)
}
}
@@ -623,7 +623,7 @@ func TestScanlnNoNewline(t *testing.T) {
_, err := Sscanln("1 x\n", &a)
if err == nil {
t.Error("expected error scanning string missing newline")
- } else if strings.Index(err.Error(), "newline") < 0 {
+ } else if !strings.Contains(err.Error(), "newline") {
t.Errorf("expected newline error scanning string missing newline, got: %s", err)
}
}
@@ -634,7 +634,7 @@ func TestScanlnWithMiddleNewline(t *testing.T) {
_, err := Fscanln(r, &a, &b)
if err == nil {
t.Error("expected error scanning string with extra newline")
- } else if strings.Index(err.Error(), "newline") < 0 {
+ } else if !strings.Contains(err.Error(), "newline") {
t.Errorf("expected newline error scanning string with extra newline, got: %s", err)
}
}