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

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

Issue 607153002: Support percent/permille formats with positive and negative variations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update CHANGELOG.md and bump package version number Created 6 years, 2 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
« no previous file with comments | « pkg/intl/pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Verify that we can pass null in order to specify the currency symbol 180 // Verify that we can pass null in order to specify the currency symbol
181 // but use the default locale. 181 // but use the default locale.
182 var defaultLocale = new NumberFormat.currencyPattern(null, 'Smurfs'); 182 var defaultLocale = new NumberFormat.currencyPattern(null, 'Smurfs');
183 formatted = defaultLocale.format(amount); 183 formatted = defaultLocale.format(amount);
184 // We don't know what the exact format will be, but it should have Smurfs. 184 // We don't know what the exact format will be, but it should have Smurfs.
185 expect(formatted.contains('Smurfs'), isTrue); 185 expect(formatted.contains('Smurfs'), isTrue);
186 readBack = defaultLocale.parse(formatted); 186 readBack = defaultLocale.parse(formatted);
187 expect(readBack, amount); 187 expect(readBack, amount);
188 }); 188 });
189 189
190 test("Delta percent format", () {
191 var f = new NumberFormat("+#,##0%;-#,##0%");
192 expect(f.format(-0.07), "-7%");
193 expect(f.format(0.12), "+12%");
194 });
195
190 test('Unparseable', () { 196 test('Unparseable', () {
191 var format = new NumberFormat.currencyPattern(); 197 var format = new NumberFormat.currencyPattern();
192 expect(() => format.parse("abcdefg"), throwsFormatException); 198 expect(() => format.parse("abcdefg"), throwsFormatException);
193 expect(() => format.parse(""), throwsFormatException); 199 expect(() => format.parse(""), throwsFormatException);
194 expect(() => format.parse("1.0zzz"), throwsFormatException); 200 expect(() => format.parse("1.0zzz"), throwsFormatException);
195 expect(() => format.parse("-∞+1"), throwsFormatException); 201 expect(() => format.parse("-∞+1"), throwsFormatException);
196 }); 202 });
197 } 203 }
OLDNEW
« no previous file with comments | « pkg/intl/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698