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

Side by Side Diff: pkg/intl/test/number_format_test.dart

Issue 332663002: pkg/matcher: add isNaN and isNotNaN matchers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /** 1 /**
2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 * for details. All rights reserved. Use of this source code is governed by a 3 * for details. All rights reserved. Use of this source code is governed by a
4 * BSD-style license that can be found in the LICENSE file. 4 * BSD-style license that can be found in the LICENSE file.
5 */ 5 */
6 6
7 library number_format_test; 7 library number_format_test;
8 8
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'package:intl/number_symbols_data.dart'; 10 import 'package:intl/number_symbols_data.dart';
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 test('Simple set of numbers', () { 97 test('Simple set of numbers', () {
98 var number = new NumberFormat(); 98 var number = new NumberFormat();
99 for (var x in allTestNumbers.keys) { 99 for (var x in allTestNumbers.keys) {
100 var formatted = number.format(allTestNumbers[x]); 100 var formatted = number.format(allTestNumbers[x]);
101 expect(formatted, x); 101 expect(formatted, x);
102 if (!testNumbersWeCannotReadBack.containsKey(x)) { 102 if (!testNumbersWeCannotReadBack.containsKey(x)) {
103 var readBack = number.parse(formatted); 103 var readBack = number.parse(formatted);
104 // Even among ones we can read back, we can't test NaN for equality. 104 // Even among ones we can read back, we can't test NaN for equality.
105 if (allTestNumbers[x].isNaN) { 105 if (allTestNumbers[x].isNaN) {
106 expect(readBack.isNaN, isTrue); 106 expect(readBack, isNaN);
107 } else { 107 } else {
108 expect(readBack, allTestNumbers[x]); 108 expect(readBack, allTestNumbers[x]);
109 } 109 }
110 } 110 }
111 } 111 }
112 }); 112 });
113 113
114 test('Exponential form', () { 114 test('Exponential form', () {
115 var number = new NumberFormat("#.###E0"); 115 var number = new NumberFormat("#.###E0");
116 for (var x in testExponential.keys) { 116 for (var x in testExponential.keys) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 }); 153 });
154 154
155 test('Unparseable', () { 155 test('Unparseable', () {
156 var format = new NumberFormat.currencyPattern(); 156 var format = new NumberFormat.currencyPattern();
157 expect(() => format.parse("abcdefg"), throwsFormatException); 157 expect(() => format.parse("abcdefg"), throwsFormatException);
158 expect(() => format.parse(""), throwsFormatException); 158 expect(() => format.parse(""), throwsFormatException);
159 expect(() => format.parse("1.0zzz"), throwsFormatException); 159 expect(() => format.parse("1.0zzz"), throwsFormatException);
160 expect(() => format.parse("-∞+1"), throwsFormatException); 160 expect(() => format.parse("-∞+1"), throwsFormatException);
161 }); 161 });
162 } 162 }
OLDNEW
« no previous file with comments | « no previous file | pkg/matcher/lib/src/core_matchers.dart » ('j') | pkg/matcher/lib/src/core_matchers.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698