OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package fmt_test | 5 package fmt_test |
6 | 6 |
7 import ( | 7 import ( |
8 . "fmt" | 8 . "fmt" |
9 "io" | 9 "io" |
10 "math" | 10 "math" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 fmtTest{"%v", renamedInt16(10), "10"}, | 327 fmtTest{"%v", renamedInt16(10), "10"}, |
328 fmtTest{"%v", renamedInt32(-11), "-11"}, | 328 fmtTest{"%v", renamedInt32(-11), "-11"}, |
329 fmtTest{"%X", renamedInt64(255), "FF"}, | 329 fmtTest{"%X", renamedInt64(255), "FF"}, |
330 fmtTest{"%v", renamedUint(13), "13"}, | 330 fmtTest{"%v", renamedUint(13), "13"}, |
331 fmtTest{"%o", renamedUint8(14), "16"}, | 331 fmtTest{"%o", renamedUint8(14), "16"}, |
332 fmtTest{"%X", renamedUint16(15), "F"}, | 332 fmtTest{"%X", renamedUint16(15), "F"}, |
333 fmtTest{"%d", renamedUint32(16), "16"}, | 333 fmtTest{"%d", renamedUint32(16), "16"}, |
334 fmtTest{"%X", renamedUint64(17), "11"}, | 334 fmtTest{"%X", renamedUint64(17), "11"}, |
335 fmtTest{"%o", renamedUintptr(18), "22"}, | 335 fmtTest{"%o", renamedUintptr(18), "22"}, |
336 fmtTest{"%x", renamedString("thing"), "7468696e67"}, | 336 fmtTest{"%x", renamedString("thing"), "7468696e67"}, |
337 » // TODO: It would be nice if this one worked, but it's hard. | 337 » fmtTest{"%q", renamedBytes([]byte("hello")), `"hello"`}, |
338 » //» fmtTest{"%q", renamedBytes([]byte("hello")), `"hello"`}, | |
339 fmtTest{"%v", renamedFloat(11), "11"}, | 338 fmtTest{"%v", renamedFloat(11), "11"}, |
340 fmtTest{"%v", renamedFloat32(22), "22"}, | 339 fmtTest{"%v", renamedFloat32(22), "22"}, |
341 fmtTest{"%v", renamedFloat64(33), "33"}, | 340 fmtTest{"%v", renamedFloat64(33), "33"}, |
342 fmtTest{"%v", renamedComplex(7 + .2i), "(7+0.2i)"}, | 341 fmtTest{"%v", renamedComplex(7 + .2i), "(7+0.2i)"}, |
343 fmtTest{"%v", renamedComplex64(3 + 4i), "(3+4i)"}, | 342 fmtTest{"%v", renamedComplex64(3 + 4i), "(3+4i)"}, |
344 fmtTest{"%v", renamedComplex128(4 - 3i), "(4-3i)"}, | 343 fmtTest{"%v", renamedComplex128(4 - 3i), "(4-3i)"}, |
345 | 344 |
346 // Formatter | 345 // Formatter |
347 fmtTest{"%x", F(1), "<x=F(1)>"}, | 346 fmtTest{"%x", F(1), "<x=F(1)>"}, |
348 fmtTest{"%x", G(2), "2"}, | 347 fmtTest{"%x", G(2), "2"}, |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 } | 598 } |
600 s = Sprintln(f) | 599 s = Sprintln(f) |
601 if s != expect { | 600 if s != expect { |
602 t.Errorf("Sprintln wrong with Formatter: expected %q got %q\n",
expect, s) | 601 t.Errorf("Sprintln wrong with Formatter: expected %q got %q\n",
expect, s) |
603 } | 602 } |
604 s = Sprintf("%v\n", f) | 603 s = Sprintf("%v\n", f) |
605 if s != expect { | 604 if s != expect { |
606 t.Errorf("Sprintf wrong with Formatter: expected %q got %q\n", e
xpect, s) | 605 t.Errorf("Sprintf wrong with Formatter: expected %q got %q\n", e
xpect, s) |
607 } | 606 } |
608 } | 607 } |
OLD | NEW |