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

Unified Diff: pkg/intl/test/number_format_test.dart

Issue 605343002: Per-mille parsing was dividing by 100, not 1000 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: pkg/intl/test/number_format_test.dart
diff --git a/pkg/intl/test/number_format_test.dart b/pkg/intl/test/number_format_test.dart
index 52520fa33cfb69f0b30ea5a8ca20e676c19dcdb3..83d53d89b9522c4c749add1df1cbce74c530c587 100644
--- a/pkg/intl/test/number_format_test.dart
+++ b/pkg/intl/test/number_format_test.dart
@@ -18,7 +18,7 @@ import 'dart:math';
var testNumbersWeCanReadBack = {
"-1" : -1,
"-2" : -2.0,
- "-0.01" : -0.01,
+ "-0.01" : -0.01,
"0.001": 0.001,
"0.01": 0.01,
"0.1": 0.1,
@@ -76,7 +76,7 @@ inJavaScript() => 1 is double;
main() {
// For data from a list of locales, run each locale's data as a separate
- // test so we can see exactly which ones pass or fail. The test data is
+ // test so we can see exactly which ones pass or fail. The test data is
// hard-coded as printing 123, -12.3, %12,300, -1,230% in each locale.
var mainList = numberTestData;
var sortedLocales = new List.from(numberFormatSymbols.keys);
@@ -96,8 +96,8 @@ main() {
var expected = (list..moveNext()).current;
expect(formatted, expected);
var expectedNegative = (list..moveNext()).current;
- // Some of these results from CLDR have a leading LTR/RTL indicator,
- // which we don't want. We also treat the difference between Unicode
+ // Some of these results from CLDR have a leading LTR/RTL indicator,
+ // which we don't want. We also treat the difference between Unicode
// minus sign (2212) and hyphen-minus (45) as not significant.
expectedNegative = expectedNegative
.replaceAll("\u200e", "")
@@ -143,6 +143,19 @@ main() {
}
});
+ // We can't do these in the normal tests because those also format the
+ // numbers and we're reading them in a format where they won't print
+ // back the same way.
+ test('Parsing modifiers,e.g. percent, in the base format', () {
+ var number = new NumberFormat();
+ var modified = { "12%" : 0.12, "12\u2030" : 0.012};
+ modified.addAll(testExponential);
+ for (var x in modified.keys) {
+ var parsed = number.parse(x);
+ expect(parsed, modified[x]);
+ }
+ });
+
test('Explicit currency name', () {
var amount = 1000000.32;
var usConvention = new NumberFormat.currencyPattern('en_US', '€');
« pkg/intl/lib/src/intl/number_format.dart ('K') | « pkg/intl/lib/src/intl/number_format.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698