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 "os" | 10 "os" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 ScanTest{"109\n", &renamedUint8Val, renamedUint8(109)}, | 176 ScanTest{"109\n", &renamedUint8Val, renamedUint8(109)}, |
177 ScanTest{"110\n", &renamedUint16Val, renamedUint16(110)}, | 177 ScanTest{"110\n", &renamedUint16Val, renamedUint16(110)}, |
178 ScanTest{"111\n", &renamedUint32Val, renamedUint32(111)}, | 178 ScanTest{"111\n", &renamedUint32Val, renamedUint32(111)}, |
179 ScanTest{"112\n", &renamedUint64Val, renamedUint64(112)}, | 179 ScanTest{"112\n", &renamedUint64Val, renamedUint64(112)}, |
180 ScanTest{"113\n", &renamedUintptrVal, renamedUintptr(113)}, | 180 ScanTest{"113\n", &renamedUintptrVal, renamedUintptr(113)}, |
181 ScanTest{"114\n", &renamedStringVal, renamedString("114")}, | 181 ScanTest{"114\n", &renamedStringVal, renamedString("114")}, |
182 ScanTest{"115\n", &renamedBytesVal, renamedBytes([]byte("115"))}, | 182 ScanTest{"115\n", &renamedBytesVal, renamedBytes([]byte("115"))}, |
183 | 183 |
184 // Custom scanner. | 184 // Custom scanner. |
185 ScanTest{" vvv ", &xVal, Xs("vvv")}, | 185 ScanTest{" vvv ", &xVal, Xs("vvv")}, |
| 186 |
| 187 // Fixed bugs |
| 188 ScanTest{"2147483648\n", &int64Val, int64(2147483648)}, // was: integer
overflow |
186 } | 189 } |
187 | 190 |
188 var scanfTests = []ScanfTest{ | 191 var scanfTests = []ScanfTest{ |
189 ScanfTest{"%v", "TRUE\n", &boolVal, true}, | 192 ScanfTest{"%v", "TRUE\n", &boolVal, true}, |
190 ScanfTest{"%t", "false\n", &boolVal, false}, | 193 ScanfTest{"%t", "false\n", &boolVal, false}, |
191 ScanfTest{"%v", "-71\n", &intVal, -71}, | 194 ScanfTest{"%v", "-71\n", &intVal, -71}, |
192 ScanfTest{"%d", "72\n", &intVal, 72}, | 195 ScanfTest{"%d", "72\n", &intVal, 72}, |
193 ScanfTest{"%c", "a\n", &intVal, 'a'}, | 196 ScanfTest{"%c", "a\n", &intVal, 'a'}, |
194 ScanfTest{"%c", "\u5072\n", &intVal, 0x5072}, | 197 ScanfTest{"%c", "\u5072\n", &intVal, 0x5072}, |
195 ScanfTest{"%c", "\u1234\n", &intVal, '\u1234'}, | 198 ScanfTest{"%c", "\u1234\n", &intVal, '\u1234'}, |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 if err == nil { | 575 if err == nil { |
573 t.Error("expected error scanning empty string") | 576 t.Error("expected error scanning empty string") |
574 } | 577 } |
575 if n != 0 { | 578 if n != 0 { |
576 t.Error("expected to scan zero items, got", n) | 579 t.Error("expected to scan zero items, got", n) |
577 } | 580 } |
578 if ec.eofCount != 1 { | 581 if ec.eofCount != 1 { |
579 t.Error("expected one EOF, got", ec.eofCount) | 582 t.Error("expected one EOF, got", ec.eofCount) |
580 } | 583 } |
581 } | 584 } |
OLD | NEW |