aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/fmt/fmt_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/fmt/fmt_test.go')
-rw-r--r--libgo/go/fmt/fmt_test.go19
1 files changed, 14 insertions, 5 deletions
diff --git a/libgo/go/fmt/fmt_test.go b/libgo/go/fmt/fmt_test.go
index b9e3bc6..550c196 100644
--- a/libgo/go/fmt/fmt_test.go
+++ b/libgo/go/fmt/fmt_test.go
@@ -236,10 +236,10 @@ var fmtTests = []struct {
{"%#q", "\U0010ffff", "`􏿿`"},
{"%#+q", "\U0010ffff", "`􏿿`"},
// Runes that are not valid.
- {"%q", string(0x110000), `"�"`},
- {"%+q", string(0x110000), `"\ufffd"`},
- {"%#q", string(0x110000), "`�`"},
- {"%#+q", string(0x110000), "`�`"},
+ {"%q", string(rune(0x110000)), `"�"`},
+ {"%+q", string(rune(0x110000)), `"\ufffd"`},
+ {"%#q", string(rune(0x110000)), "`�`"},
+ {"%#+q", string(rune(0x110000)), "`�`"},
// characters
{"%c", uint('x'), "x"},
@@ -463,6 +463,15 @@ var fmtTests = []struct {
{"%#.4x", 1.0, "0x1.0000p+00"},
{"%#.4g", 1.0, "1.000"},
{"%#.4g", 100000.0, "1.000e+05"},
+ {"%#.4g", 1.234, "1.234"},
+ {"%#.4g", 0.1234, "0.1234"},
+ {"%#.4g", 1.23, "1.230"},
+ {"%#.4g", 0.123, "0.1230"},
+ {"%#.4g", 1.2, "1.200"},
+ {"%#.4g", 0.12, "0.1200"},
+ {"%#.4g", 10.2, "10.20"},
+ {"%#.4g", 0.0, "0.000"},
+ {"%#.4g", 0.012, "0.01200"},
{"%#.0f", 123.0, "123."},
{"%#.0e", 123.0, "1.e+02"},
{"%#.0x", 123.0, "0x1.p+07"},
@@ -1459,7 +1468,7 @@ func (flagPrinter) Format(f State, c rune) {
s := "%"
for i := 0; i < 128; i++ {
if f.Flag(i) {
- s += string(i)
+ s += string(rune(i))
}
}
if w, ok := f.Width(); ok {