Commit c70bdd37 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: fix bad generated format strings in test

We were generating format strings containing
a lone %. Vet legitimately complains:

cmd/compile/internal/gc/constFold_test.go:339: unrecognized printf verb ' '

The fix doesn't make for very readable code,
but it is simple and obviously correct.

Updates #11041

Change-Id: I90bd2d1d140887f5229752a279f7e46921472fbb
Reviewed-on: https://go-review.googlesource.com/27115
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 2cbe7353
......@@ -144,7 +144,7 @@ func main() {
fmt.Fprintf(w, "\tr = x %s y\n", o.symbol)
want := ansU(c, d, s.name, o.symbol)
fmt.Fprintf(w, "\tif r != %s {\n", want)
fmt.Fprintf(w, "\t\tt.Errorf(\"%d %s %d = %%d, want %s\", r)\n", c, o.symbol, d, want)
fmt.Fprintf(w, "\t\tt.Errorf(\"%d %%s %d = %%d, want %s\", %q, r)\n", c, d, want, o.symbol)
fmt.Fprintf(w, "\t}\n")
}
}
......@@ -159,7 +159,7 @@ func main() {
fmt.Fprintf(w, "\tr = x %s y\n", o.symbol)
want := ansS(c, d, s.name, o.symbol)
fmt.Fprintf(w, "\tif r != %s {\n", want)
fmt.Fprintf(w, "\t\tt.Errorf(\"%d %s %d = %%d, want %s\", r)\n", c, o.symbol, d, want)
fmt.Fprintf(w, "\t\tt.Errorf(\"%d %%s %d = %%d, want %s\", %q, r)\n", c, d, want, o.symbol)
fmt.Fprintf(w, "\t}\n")
}
}
......@@ -188,7 +188,7 @@ func main() {
fmt.Fprintf(w, "\tr = x %s y\n", o.symbol)
want := ansU(c, d, ls.name, o.symbol)
fmt.Fprintf(w, "\tif r != %s {\n", want)
fmt.Fprintf(w, "\t\tt.Errorf(\"%d %s %d = %%d, want %s\", r)\n", c, o.symbol, d, want)
fmt.Fprintf(w, "\t\tt.Errorf(\"%d %%s %d = %%d, want %s\", %q, r)\n", c, d, want, o.symbol)
fmt.Fprintf(w, "\t}\n")
}
}
......@@ -200,7 +200,7 @@ func main() {
fmt.Fprintf(w, "\tr = x %s y\n", o.symbol)
want := ansS(c, int64(d), ls.name, o.symbol)
fmt.Fprintf(w, "\tif r != %s {\n", want)
fmt.Fprintf(w, "\t\tt.Errorf(\"%d %s %d = %%d, want %s\", r)\n", c, o.symbol, d, want)
fmt.Fprintf(w, "\t\tt.Errorf(\"%d %%s %d = %%d, want %s\", %q, r)\n", c, d, want, o.symbol)
fmt.Fprintf(w, "\t}\n")
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment