diff options
Diffstat (limited to 'libgo/go/fmt/scan_test.go')
-rw-r--r-- | libgo/go/fmt/scan_test.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libgo/go/fmt/scan_test.go b/libgo/go/fmt/scan_test.go index 334c4a6..7ac74dcb 100644 --- a/libgo/go/fmt/scan_test.go +++ b/libgo/go/fmt/scan_test.go @@ -255,12 +255,14 @@ var scanfTests = []ScanfTest{ // Strings {"%s", "using-%s\n", &stringVal, "using-%s"}, {"%x", "7573696e672d2578\n", &stringVal, "using-%x"}, + {"%X", "7573696E672D2558\n", &stringVal, "using-%X"}, {"%q", `"quoted\twith\\do\u0075bl\x65s"` + "\n", &stringVal, "quoted\twith\\doubles"}, {"%q", "`quoted with backs`\n", &stringVal, "quoted with backs"}, // Byte slices {"%s", "bytes-%s\n", &bytesVal, []byte("bytes-%s")}, {"%x", "62797465732d2578\n", &bytesVal, []byte("bytes-%x")}, + {"%X", "62797465732D2558\n", &bytesVal, []byte("bytes-%X")}, {"%q", `"bytes\rwith\vdo\u0075bl\x65s"` + "\n", &bytesVal, []byte("bytes\rwith\vdoubles")}, {"%q", "`bytes with backs`\n", &bytesVal, []byte("bytes with backs")}, @@ -291,6 +293,7 @@ var scanfTests = []ScanfTest{ // Interesting formats {"here is\tthe value:%d", "here is the\tvalue:118\n", &intVal, 118}, {"%% %%:%d", "% %:119\n", &intVal, 119}, + {"%d%%", "42%", &intVal, 42}, // %% at end of string. // Corner cases {"%x", "FFFFFFFF\n", &uint32Val, uint32(0xFFFFFFFF)}, @@ -356,6 +359,8 @@ var multiTests = []ScanfMultiTest{ {"%d %d", "23 18 27", args(&i, &j, &k), args(23, 18), "too many operands"}, {"%c", "\u0100", args(&int8Val), nil, "overflow"}, {"X%d", "10X", args(&intVal), nil, "input does not match format"}, + {"%d%", "42%", args(&intVal), args(42), "missing verb: % at end of format string"}, + {"%d% ", "42%", args(&intVal), args(42), "too few operands for format '% '"}, // Slightly odd error, but correct. // Bad UTF-8: should see every byte. {"%c%c%c", "\xc2X\xc2", args(&r1, &r2, &r3), args(utf8.RuneError, 'X', utf8.RuneError), ""}, |