Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Update Intl to require Dart 2.0, remove deprecated API usage
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204549210
  • Loading branch information
alan-knight committed Jul 13, 2018
1 parent 4b38551 commit 5e08174
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## 0.15.7
* Upate to require Dart 2.0. Remove deprecated calls,
* Compensate for rare cases where a parsed Date in date-only format gets a
1:00am time. This is presumably because of DST time-shifts. We may not be
able to correct these dates, because midnight may not exist at a transition
Expand Down
2 changes: 1 addition & 1 deletion lib/src/intl/number_format.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ class _NumberParser {
}

var normalizedText = _normalized.toString();
num parsed = int.parse(normalizedText, onError: (message) => null);
num parsed = int.tryParse(normalizedText);
if (parsed == null) parsed = double.parse(normalizedText);
return parsed / scale;
}
Expand Down
19 changes: 9 additions & 10 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
name: intl
version: 0.15.7-dev
version: 0.15.7
author: Dart Team <misc@dartlang.org>
description: Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues.
homepage: https://github.com/dart-lang/intl
description: >-
Contains code to deal with internationalized/localized messages, date and
number formatting and parsing, bi-directional text, and other
internationalization issues.
environment:
sdk: '>=1.24.0 <2.0.0'
sdk: '>=2.0.0-dev.48 <3.0.0'
documentation: http://www.dartdocs.org/documentation/intl/latest

dependencies:
path: '>=0.9.0 <2.0.0'
dev_dependencies:
fixnum: '>=0.9.0 <0.11.0'
test: '>=0.12.0 <0.13.0'
transformers:
- $dart2js:
$exclude:
- test/date_time_format_file_even_test.dart
- test/date_time_format_file_odd_test.dart
- test/find_default_locale_standalone_test.dart
test: ^1.2.0
1 change: 1 addition & 0 deletions test/fixnum_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ main() {

test('micro money', () {
microMoneyValues.forEach((number, expected) {
// ignore: deprecated_member_use
var currency = new NumberFormat.currencyPattern().format(number);
expect(currency, expected.first);
var percent = new NumberFormat.percentPattern().format(number);
Expand Down
5 changes: 4 additions & 1 deletion test/number_format_test_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ runTests(Map<String, num> allTestNumbers) {
expect(formatted, '€1,000,000.32');
var readBack = usConvention.parse(formatted);
expect(readBack, amount);
// ignore: deprecated_member_use
var swissConvention = new NumberFormat.currencyPattern('de_CH', r'$');
formatted = swissConvention.format(amount);
var nbsp = new String.fromCharCode(0xa0);
Expand All @@ -158,7 +159,8 @@ runTests(Map<String, num> allTestNumbers) {
readBack = swissConvention.parse(formatted);
expect(readBack, amount);

var italianSwiss = new NumberFormat.currencyPattern('it_CH', r'$');
// ignore: deprecated_member_use
var italianSwiss = new NumberFormat.currencyPattern('it_CH', r'$');
formatted = italianSwiss.format(amount);
expect(formatted,
r"$" + nbsp + "1" + backquote + "000" + backquote + "000.32");
Expand All @@ -175,6 +177,7 @@ runTests(Map<String, num> allTestNumbers) {

// Verify that we can pass null in order to specify the currency symbol
// but use the default locale.
// ignore: deprecated_member_use
var defaultLocale = new NumberFormat.currencyPattern(null, 'Smurfs');
formatted = defaultLocale.format(amount);
// We don't know what the exact format will be, but it should have Smurfs.
Expand Down

0 comments on commit 5e08174

Please sign in to comment.