| OLD | NEW |
| 1 // for details. All rights reserved. Use of this source code is governed by a | 1 // for details. All rights reserved. Use of this source code is governed by a |
| 2 // BSD-style license that can be found in the LICENSE file. | 2 // BSD-style license that can be found in the LICENSE file. |
| 3 | 3 |
| 4 /** | 4 /** |
| 5 * Tests based on the closure number formatting tests. | 5 * Tests based on the closure number formatting tests. |
| 6 */ | 6 */ |
| 7 library number_closure_test; | 7 library number_closure_test; |
| 8 | 8 |
| 9 import "package:intl/intl.dart"; | 9 import "package:intl/intl.dart"; |
| 10 import "package:unittest/unittest.dart"; | 10 import "package:unittest/unittest.dart"; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 return str1.length == str2.length && | 33 return str1.length == str2.length && |
| 34 str1.substring(0, 8) == str2.substring(0, 8); | 34 str1.substring(0, 8) == str2.substring(0, 8); |
| 35 } | 35 } |
| 36 | 36 |
| 37 testVeryBigNumber() { | 37 testVeryBigNumber() { |
| 38 var str; | 38 var str; |
| 39 var fmt; | 39 var fmt; |
| 40 | 40 |
| 41 fmt = new NumberFormat.decimalPattern(); | 41 fmt = new NumberFormat.decimalPattern(); |
| 42 str = fmt.format(1.3456E20); | 42 str = fmt.format(1.3456E20); |
| 43 expect(veryBigNumberCompare('134,559,999,999,999,000,000', str), isTrue); | 43 expect(veryBigNumberCompare('134,560,000,000,000,000,000', str), isTrue); |
| 44 | 44 |
| 45 fmt = new NumberFormat.percentPattern(); | 45 fmt = new NumberFormat.percentPattern(); |
| 46 str = fmt.format(1.3456E20); | 46 str = fmt.format(1.3456E20); |
| 47 expect(veryBigNumberCompare('13,456,000,000,000,000,000,000%', str), isTrue); | 47 expect(veryBigNumberCompare('13,456,000,000,000,000,000,000%', str), isTrue); |
| 48 | 48 |
| 49 // TODO(alanknight): Note that this disagrees with what ICU would print | 49 // TODO(alanknight): Note that this disagrees with what ICU would print |
| 50 // for this. We need significant digit support to do this properly. | 50 // for this. We need significant digit support to do this properly. |
| 51 fmt = new NumberFormat.scientificPattern(); | 51 fmt = new NumberFormat.scientificPattern(); |
| 52 str = fmt.format(1.3456E20); | 52 str = fmt.format(1.3456E20); |
| 53 expect('1E20', str); | 53 expect('1E20', str); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 379 |
| 380 testLocaleSwitch() { | 380 testLocaleSwitch() { |
| 381 Intl.withLocale("fr", verifyFrenchLocale); | 381 Intl.withLocale("fr", verifyFrenchLocale); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void verifyFrenchLocale() { | 384 void verifyFrenchLocale() { |
| 385 var fmt = new NumberFormat('#,###'); | 385 var fmt = new NumberFormat('#,###'); |
| 386 var str = fmt.format(1234567890); | 386 var str = fmt.format(1234567890); |
| 387 expect('1\u00a0234\u00a0567\u00a0890', str); | 387 expect('1\u00a0234\u00a0567\u00a0890', str); |
| 388 } | 388 } |
| OLD | NEW |