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

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: Addressing comments Created 6 years, 5 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 test('Simple set of numbers', () { 113 test('Simple set of numbers', () {
114 var number = new NumberFormat(); 114 var number = new NumberFormat();
115 for (var x in allTestNumbers.keys) { 115 for (var x in allTestNumbers.keys) {
116 var formatted = number.format(allTestNumbers[x]); 116 var formatted = number.format(allTestNumbers[x]);
117 expect(formatted, x); 117 expect(formatted, x);
118 if (!testNumbersWeCannotReadBack.containsKey(x)) { 118 if (!testNumbersWeCannotReadBack.containsKey(x)) {
119 var readBack = number.parse(formatted); 119 var readBack = number.parse(formatted);
120 // Even among ones we can read back, we can't test NaN for equality. 120 // Even among ones we can read back, we can't test NaN for equality.
121 if (allTestNumbers[x].isNaN) { 121 if (allTestNumbers[x].isNaN) {
122 expect(readBack.isNaN, isTrue); 122 expect(readBack, isNaN);
123 } else { 123 } else {
124 expect(readBack, allTestNumbers[x]); 124 expect(readBack, allTestNumbers[x]);
125 } 125 }
126 } 126 }
127 } 127 }
128 }); 128 });
129 129
130 test('Exponential form', () { 130 test('Exponential form', () {
131 var number = new NumberFormat("#.###E0"); 131 var number = new NumberFormat("#.###E0");
132 for (var x in testExponential.keys) { 132 for (var x in testExponential.keys) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 }); 169 });
170 170
171 test('Unparseable', () { 171 test('Unparseable', () {
172 var format = new NumberFormat.currencyPattern(); 172 var format = new NumberFormat.currencyPattern();
173 expect(() => format.parse("abcdefg"), throwsFormatException); 173 expect(() => format.parse("abcdefg"), throwsFormatException);
174 expect(() => format.parse(""), throwsFormatException); 174 expect(() => format.parse(""), throwsFormatException);
175 expect(() => format.parse("1.0zzz"), throwsFormatException); 175 expect(() => format.parse("1.0zzz"), throwsFormatException);
176 expect(() => format.parse("-∞+1"), throwsFormatException); 176 expect(() => format.parse("-∞+1"), throwsFormatException);
177 }); 177 });
178 } 178 }
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