Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(738)

Side by Side Diff: packages/intl/test/number_closure_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 /// Tests based on the closure number formatting tests.
5 * Tests based on the closure number formatting tests.
6 */
7 library number_closure_test; 5 library number_closure_test;
8 6
9 import 'dart:async'; 7 import 'dart:async';
10 import "package:intl/intl.dart"; 8 import "package:intl/intl.dart";
11 import "package:unittest/unittest.dart"; 9 import "package:test/test.dart";
12 10
13 main() { 11 main() {
14 test("testVeryBigNumber", testVeryBigNumber); 12 test("testVeryBigNumber", testVeryBigNumber);
15 test("testStandardFormat", testStandardFormat); 13 test("testStandardFormat", testStandardFormat);
16 test("testNegativePercentage", testNegativePercentage); 14 test("testNegativePercentage", testNegativePercentage);
17 test("testCustomPercentage", testCustomPercentage); 15 test("testCustomPercentage", testCustomPercentage);
18 test("testBasicFormat", testBasicFormat); 16 test("testBasicFormat", testBasicFormat);
19 test("testGrouping", testGrouping); 17 test("testGrouping", testGrouping);
20 test("testPerMill", testPerMill); 18 test("testPerMill", testPerMill);
21 test("testQuotes", testQuotes); 19 test("testQuotes", testQuotes);
22 test("testZeros", testZeros); 20 test("testZeros", testZeros);
23 test("testExponential", testExponential); 21 test("testExponential", testExponential);
24 test("testPlusSignInExponentPart", testPlusSignInExponentPart); 22 test("testPlusSignInExponentPart", testPlusSignInExponentPart);
25 test("testApis", testApis); 23 test("testApis", testApis);
26 test("testLocaleSwitch", testLocaleSwitch); 24 test("testLocaleSwitch", testLocaleSwitch);
27 test("testLocaleSwitchAsync", testLocaleSwitchAsync); 25 test("testLocaleSwitchAsync", testLocaleSwitchAsync);
28 } 26 }
29 27
30 /** 28 /// Test two large numbers for equality, assuming that there may be some
31 * Test two large numbers for equality, assuming that there may be some 29 /// loss of precision in the less significant digits.
32 * loss of precision in the less significant digits.
33 */
34 veryBigNumberCompare(str1, str2) { 30 veryBigNumberCompare(str1, str2) {
35 return str1.length == str2.length && 31 return str1.length == str2.length &&
36 str1.substring(0, 8) == str2.substring(0, 8); 32 str1.substring(0, 8) == str2.substring(0, 8);
37 } 33 }
38 34
39 testVeryBigNumber() { 35 testVeryBigNumber() {
40 var str; 36 var str;
41 var fmt; 37 var fmt;
42 38
43 fmt = new NumberFormat.decimalPattern(); 39 fmt = new NumberFormat.decimalPattern();
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 372
377 fmt = new NumberFormat('#,###'); 373 fmt = new NumberFormat('#,###');
378 str = fmt.format(1234567890); 374 str = fmt.format(1234567890);
379 expect('1,234,567,890', str); 375 expect('1,234,567,890', str);
380 } 376 }
381 377
382 testLocaleSwitch() { 378 testLocaleSwitch() {
383 Intl.withLocale("fr", verifyFrenchLocale); 379 Intl.withLocale("fr", verifyFrenchLocale);
384 } 380 }
385 381
382 typedef void TimerArgument();
386 testLocaleSwitchAsync() { 383 testLocaleSwitchAsync() {
387 Intl.withLocale("fr", () { 384 Intl.withLocale("fr", () {
388 new Timer(new Duration(milliseconds: 10), expectAsync(verifyFrenchLocale)); 385 new Timer(new Duration(milliseconds: 10),
386 expectAsync(verifyFrenchLocale) as TimerArgument);
389 }); 387 });
390 // Verify that things running outside the zone still get en_US. 388 // Verify that things running outside the zone still get en_US.
391 testStandardFormat(); 389 testStandardFormat();
392 } 390 }
393 391
394 void verifyFrenchLocale() { 392 void verifyFrenchLocale() {
395 var fmt = new NumberFormat('#,###'); 393 var fmt = new NumberFormat('#,###');
396 var str = fmt.format(1234567890); 394 var str = fmt.format(1234567890);
397 expect(str, '1\u00a0234\u00a0567\u00a0890'); 395 expect(str, '1\u00a0234\u00a0567\u00a0890');
398 } 396 }
OLDNEW
« no previous file with comments | « packages/intl/test/message_extraction/verify_messages.dart ('k') | packages/intl/test/number_format_compact_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698