Migrate `package:intl` tests to null safety.
PiperOrigin-RevId: 328541300
diff --git a/test/bidi_format_test.dart b/test/bidi_format_test.dart
index 0846907..ca69e85 100644
--- a/test/bidi_format_test.dart
+++ b/test/bidi_format_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
library bidi_format_test;
diff --git a/test/bidi_utils_test.dart b/test/bidi_utils_test.dart
index 1001817..a0a2e95 100644
--- a/test/bidi_utils_test.dart
+++ b/test/bidi_utils_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
library bidi_utils_test;
diff --git a/test/brazil_timezone_test.dart b/test/brazil_timezone_test.dart
index 78edb79..6fb5bd4 100644
--- a/test/brazil_timezone_test.dart
+++ b/test/brazil_timezone_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing while the system time zone is set to
/// America/Sao Paulo.
diff --git a/test/compact_number_test_data.dart b/test/compact_number_test_data.dart
index 946938d..b862ef3 100644
--- a/test/compact_number_test_data.dart
+++ b/test/compact_number_test_data.dart
@@ -3,7 +3,6 @@
// for details. All rights reserved. Use of this source
// code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test data for compact number formatting.
///
diff --git a/test/compact_number_test_data_33.dart b/test/compact_number_test_data_33.dart
index 9ceaf61..0951c15 100644
--- a/test/compact_number_test_data_33.dart
+++ b/test/compact_number_test_data_33.dart
@@ -3,7 +3,6 @@
// for details. All rights reserved. Use of this source
// code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test data for compact number formatting.
///
diff --git a/test/data_directory.dart b/test/data_directory.dart
index e2626a5..7c849e3 100644
--- a/test/data_directory.dart
+++ b/test/data_directory.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// A utility function for test and tools that compensates (at least for very
/// simple cases) for file-dependent programs being run from different
diff --git a/test/date_format_flake_test.dart b/test/date_format_flake_test.dart
index 9be5168..c71158f 100644
--- a/test/date_format_flake_test.dart
+++ b/test/date_format_flake_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
// Tests for what happens when DateTime instance creation does flaky things.
diff --git a/test/date_time_format_custom_test.dart b/test/date_time_format_custom_test.dart
index 5341f52..f9dd5f3 100644
--- a/test/date_time_format_custom_test.dart
+++ b/test/date_time_format_custom_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing using custom locale data, which we get
/// from the local copy.
@@ -18,7 +17,7 @@
var symbols = local_symbols.dateTimeSymbolMap();
var patterns = local_patterns.dateTimePatternMap();
var locales = <String>[];
- symbols.keys.take(10).forEach(locales.add);
+ symbols.keys.take(10).forEach((locale) => locales.add(locale));
// Force inclusion of locales that are hard-coded in tests.
var requiredLocales = ['en_US', 'de', 'fr', 'ja', 'el', 'de_AT'];
locales.addAll(requiredLocales);
@@ -30,4 +29,4 @@
runWith(() => locales, null, nullInitialization);
}
-Future<void> nullInitialization(String a, String b) => Future.value(null);
+Future<void> nullInitialization(String a, String b) => Future.value();
diff --git a/test/date_time_format_file_even_test.dart b/test/date_time_format_file_even_test.dart
index b0be291..2e55022 100644
--- a/test/date_time_format_file_even_test.dart
+++ b/test/date_time_format_file_even_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Tests date formatting and parsing using locale data read from the
/// local file system. This tests one half the locales, since testing all
diff --git a/test/date_time_format_file_odd_test.dart b/test/date_time_format_file_odd_test.dart
index 527caff..687b392 100644
--- a/test/date_time_format_file_odd_test.dart
+++ b/test/date_time_format_file_odd_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Tests date formatting and parsing using locale data read from the
/// local file system. This tests one half the locales, since testing all
diff --git a/test/date_time_format_local_even_test.dart b/test/date_time_format_local_even_test.dart
index 86582e5..e52cb31 100644
--- a/test/date_time_format_local_even_test.dart
+++ b/test/date_time_format_local_even_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing using locale data which is available
/// directly in the program as a constant. This tests one half the locales,
diff --git a/test/date_time_format_local_odd_test.dart b/test/date_time_format_local_odd_test.dart
index 7ec22f7..ecede2d 100644
--- a/test/date_time_format_local_odd_test.dart
+++ b/test/date_time_format_local_odd_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing using locale data which is available
/// directly in the program as a constant. This tests one half the locales,
diff --git a/test/date_time_format_test_core.dart b/test/date_time_format_test_core.dart
index 9a699d2..600417d 100644
--- a/test/date_time_format_test_core.dart
+++ b/test/date_time_format_test_core.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Tests the DateFormat library in dart. This file contains core tests that are
/// run regardless of where the locale data is found, so it doesn't expect to be
@@ -174,19 +173,19 @@
List<String> allLocales() => DateFormat.allLocalesWithSymbols();
typedef SubsetFuncType = List<String> Function();
-SubsetFuncType _subsetFunc;
+SubsetFuncType? _subsetFunc;
-List<String> _subsetValue;
+List<String>? _subsetValue;
List<String> get subset {
- return _subsetValue ??= _subsetFunc();
+ return _subsetValue ??= _subsetFunc!();
}
// TODO(alanknight): Run specific tests for the en_ISO locale which isn't
// included in CLDR, and check that our patterns for it are correct (they
// very likely aren't).
void runDateTests(SubsetFuncType subsetFunc) {
- assert(subsetFunc != null);
+ ArgumentError.checkNotNull(subsetFunc);
_subsetFunc = subsetFunc;
test('Multiple patterns', () {
diff --git a/test/date_time_format_test_data.dart b/test/date_time_format_test_data.dart
index 9109c65..a0a57f7 100644
--- a/test/date_time_format_test_data.dart
+++ b/test/date_time_format_test_data.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test data for one particular date formatted for a small number of locales.
/// Provides at least a basic check on formatting, including formatting with
diff --git a/test/date_time_format_test_stub.dart b/test/date_time_format_test_stub.dart
index 17980ae..b790899 100644
--- a/test/date_time_format_test_stub.dart
+++ b/test/date_time_format_test_stub.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing using locale data which is available
/// directly in the program as a constant.
@@ -37,8 +36,10 @@
return allLocales().where((x) => !(i++).isOdd).toList();
}
-void runWith(TestListFunc getSubset, String dir,
+void runWith(TestListFunc getSubset, String? dir,
InitializeDateFormattingFunc initFunction) {
+ var notNullDir = dir ?? '';
+
// Initialize one locale just so we know what the list is.
// Also, note that we take the list of locales as a function so that we don't
// evaluate it until after we know that all the locales are available.
@@ -49,9 +50,10 @@
if (initialized) {
return null;
}
- return initFunction('en_US', dir).then((_) {
- return Future.forEach(DateFormat.allLocalesWithSymbols(), (locale) {
- return initFunction(locale, dir);
+ return initFunction('en_US', notNullDir).then((_) {
+ return Future.forEach(DateFormat.allLocalesWithSymbols(),
+ (String locale) {
+ return initFunction(locale, notNullDir);
});
}).then((_) {
initialized = true;
diff --git a/test/date_time_format_uninitialized_test.dart b/test/date_time_format_uninitialized_test.dart
index 7374cc1..79b09f9 100644
--- a/test/date_time_format_uninitialized_test.dart
+++ b/test/date_time_format_uninitialized_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Tests date formatting and parsing using locale data read from the
/// local file system.
diff --git a/test/date_time_loose_parsing_test.dart b/test/date_time_loose_parsing_test.dart
index c28f124..353f946 100644
--- a/test/date_time_loose_parsing_test.dart
+++ b/test/date_time_loose_parsing_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Tests for the loose option when parsing dates and times, which accept
/// mixed-case input and are able to skip missing delimiters. Such valid input
@@ -15,7 +14,7 @@
import 'package:test/test.dart';
void main() {
- DateFormat format;
+ late DateFormat format;
var date = DateTime(2014, 9, 3);
diff --git a/test/date_time_strict_test.dart b/test/date_time_strict_test.dart
index 04f9f75..730ceeb 100644
--- a/test/date_time_strict_test.dart
+++ b/test/date_time_strict_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Tests for the strict option when parsing dates and times, which are
/// relatively locale-independent, depending only on the being a valid date
diff --git a/test/england_timezone_test.dart b/test/england_timezone_test.dart
index a2479c0..33e8901 100644
--- a/test/england_timezone_test.dart
+++ b/test/england_timezone_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing while the system time zone is set to
/// Europe/London.
diff --git a/test/find_default_locale_browser_test.dart b/test/find_default_locale_browser_test.dart
index a93dda9..cfc19f5 100644
--- a/test/find_default_locale_browser_test.dart
+++ b/test/find_default_locale_browser_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
@TestOn('browser')
library find_default_locale_browser_test;
diff --git a/test/find_default_locale_standalone_test.dart b/test/find_default_locale_standalone_test.dart
index 217c281..e212848 100644
--- a/test/find_default_locale_standalone_test.dart
+++ b/test/find_default_locale_standalone_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
@TestOn('vm')
import 'package:intl/intl.dart';
diff --git a/test/fixnum_test.dart b/test/fixnum_test.dart
index 3c7b6bc..8f9f874 100644
--- a/test/fixnum_test.dart
+++ b/test/fixnum_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
library fixnum_test;
diff --git a/test/gmt_timezone_test.dart b/test/gmt_timezone_test.dart
index 1f61575..f8374ce 100644
--- a/test/gmt_timezone_test.dart
+++ b/test/gmt_timezone_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing while the system time zone is set to
/// GMT.
diff --git a/test/intl_test.dart b/test/intl_test.dart
index 0ba2f8e..77f10c5 100644
--- a/test/intl_test.dart
+++ b/test/intl_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
library intl_test;
diff --git a/test/locale_test.dart b/test/locale_test.dart
index 69d0cf4..59d75af 100644
--- a/test/locale_test.dart
+++ b/test/locale_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Tests for the Locale class.
///
@@ -40,7 +39,7 @@
group('Locale.fromSubtags() FormatExceptions:', () {
void testExceptionForSubtags(
- String language, String script, String region) {
+ String language, String? script, String? region) {
test('fromSubtags: "$language / $script / $region"', () {
expect(
() => Locale.fromSubtags(
@@ -175,7 +174,7 @@
test('Locale cannot be modified via the variants field', () {
var l = Locale.parse('en-scotland');
- List<String> v = l.variants;
+ var v = l.variants as List<String>;
var good = false;
try {
v.add('basiceng');
@@ -205,12 +204,12 @@
void testFromSubtags(
String language,
- String script,
- String region,
- String expectedLanguage,
- String expectedScript,
- String expectedRegion,
- String expectedTag) {
+ String? script,
+ String? region,
+ String? expectedLanguage,
+ String? expectedScript,
+ String? expectedRegion,
+ String? expectedTag) {
test('Locale.fromSubtags(...) with $language, $script, $region', () {
var l = Locale.fromSubtags(
languageCode: language, scriptCode: script, countryCode: region);
@@ -225,10 +224,10 @@
void testParse(
String bcp47Tag,
String expectedLanguage,
- String expectedScript,
- String expectedRegion,
+ String? expectedScript,
+ String? expectedRegion,
Iterable<String> expectedVariants,
- String expectedTag) {
+ String? expectedTag) {
test('Locale.parse("$bcp47Tag");', () {
var l = Locale.parse(bcp47Tag);
expect(l.languageCode, expectedLanguage);
diff --git a/test/locale_test_data.dart b/test/locale_test_data.dart
index 40b7a10..9cd6f70 100644
--- a/test/locale_test_data.dart
+++ b/test/locale_test_data.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test data for Locale handling.
///
diff --git a/test/message_format_test.dart b/test/message_format_test.dart
index f61abee..03a2b47 100644
--- a/test/message_format_test.dart
+++ b/test/message_format_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Tests for the MessageFormat class.
///
diff --git a/test/more_compact_number_test_data.dart b/test/more_compact_number_test_data.dart
index cef3f3a..ef75c34 100644
--- a/test/more_compact_number_test_data.dart
+++ b/test/more_compact_number_test_data.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
class CompactRoundingTestCase {
CompactRoundingTestCase(this.number, this.expected,
@@ -14,12 +13,12 @@
num number;
String expected;
- int maximumIntegerDigits;
- int minimumIntegerDigits;
- int maximumFractionDigits;
- int minimumFractionDigits;
- int minimumExponentDigits;
- int significantDigits;
+ int? maximumIntegerDigits;
+ int? minimumIntegerDigits;
+ int? maximumFractionDigits;
+ int? minimumFractionDigits;
+ int? minimumExponentDigits;
+ int? significantDigits;
String toString() => "CompactRoundingTestCase for $number, "
"maxIntDig: $maximumIntegerDigits, "
diff --git a/test/number_closure_test.dart b/test/number_closure_test.dart
index 3e25e60..558b2dc 100644
--- a/test/number_closure_test.dart
+++ b/test/number_closure_test.dart
@@ -1,7 +1,6 @@
/// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
/// for details. All rights reserved. Use of this source code is governed by a
/// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Tests based on the closure number formatting tests.
library number_closure_test;
diff --git a/test/number_format_compact_icu_test.dart b/test/number_format_compact_icu_test.dart
index 51ee653..08cde65 100644
--- a/test/number_format_compact_icu_test.dart
+++ b/test/number_format_compact_icu_test.dart
@@ -4,6 +4,7 @@
/// testing the package:intl implementation, they only help verify consistent
/// behaviour across platforms.
// @dart=2.9
+
@TestOn("!browser")
@Tags(['ffi'])
@Skip(
diff --git a/test/number_format_compact_test.dart b/test/number_format_compact_test.dart
index 1fe900e..0103c97 100644
--- a/test/number_format_compact_test.dart
+++ b/test/number_format_compact_test.dart
@@ -1,7 +1,6 @@
/// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
/// for details. All rights reserved. Use of this source code is governed by a
/// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Tests for compact format numbers, e.g. 1.2M rather than 1,200,000
import 'dart:math';
@@ -101,7 +100,7 @@
/// output of the formatters with significantDigits set to `1`.
void testCurrency(
String locale, num number, String expected, String expectedShort,
- {String currency, String reason}) {
+ {String? currency, String? reason}) {
test('Compact simple currency for $locale, $number', () {
var format =
NumberFormat.compactSimpleCurrency(locale: locale, name: currency);
@@ -220,7 +219,7 @@
for (var data in expected) {
var number = num.parse(data.first);
validateNumber(number, shortFormat, data[1]);
- var int64Number = Int64(number);
+ var int64Number = Int64(number as int);
validateNumber(int64Number, shortFormat, data[1]);
// TODO(alanknight): Make this work for MicroMoney
}
@@ -259,7 +258,7 @@
/// 999999 may print as 1M.
num roundForPrinting(number, NumberFormat format) {
var originalLength = NumberFormat.numberOfIntegerDigits(number);
- var additionalDigits = originalLength - format.significantDigits;
+ var additionalDigits = originalLength - format.significantDigits!;
if (additionalDigits > 0) {
var divisor = pow(10, additionalDigits);
// If we have an Int64, value speed over precision and make it double.
@@ -317,23 +316,23 @@
void validateFancy(more_testdata.CompactRoundingTestCase t) {
var shortFormat = NumberFormat.compact(locale: 'en');
if (t.maximumIntegerDigits != null) {
- shortFormat.maximumIntegerDigits = t.maximumIntegerDigits;
+ shortFormat.maximumIntegerDigits = t.maximumIntegerDigits!;
}
if (t.minimumIntegerDigits != null) {
- shortFormat.minimumIntegerDigits = t.minimumIntegerDigits;
+ shortFormat.minimumIntegerDigits = t.minimumIntegerDigits!;
}
if (t.maximumFractionDigits != null) {
- shortFormat.maximumFractionDigits = t.maximumFractionDigits;
+ shortFormat.maximumFractionDigits = t.maximumFractionDigits!;
}
if (t.minimumFractionDigits != null) {
- shortFormat.minimumFractionDigits = t.minimumFractionDigits;
+ shortFormat.minimumFractionDigits = t.minimumFractionDigits!;
}
if (t.minimumExponentDigits != null) {
- shortFormat.minimumExponentDigits = t.minimumExponentDigits;
+ shortFormat.minimumExponentDigits = t.minimumExponentDigits!;
}
if (t.significantDigits != null) {
diff --git a/test/number_format_compact_web_test.dart b/test/number_format_compact_web_test.dart
index 950775b..2508eb6 100644
--- a/test/number_format_compact_web_test.dart
+++ b/test/number_format_compact_web_test.dart
@@ -4,7 +4,6 @@
/// consistency when the bug is fixed. Also fix documentation and perhaps
/// merge tests: these tests currently also touch non-compact currency
/// formatting.
-// @dart=2.9
/// We use @Tags rather than @TestOn to be able to specify something that can be
/// ignored when using a build system that can't read dart_test.yaml. This
@@ -63,7 +62,10 @@
}
String ecmaFormatNumber(String locale, num number,
- {String style, String currency, String notation, String compactDisplay}) {
+ {String? style,
+ String? currency,
+ String? notation,
+ String? compactDisplay}) {
var options = js.newObject();
if (notation != null) js.setProperty(options, 'notation', notation);
if (compactDisplay != null) {
diff --git a/test/number_format_test_core.dart b/test/number_format_test_core.dart
index 7f30a76..2c74137 100644
--- a/test/number_format_test_core.dart
+++ b/test/number_format_test_core.dart
@@ -1,7 +1,6 @@
/// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
/// for details. All rights reserved. Use of this source code is governed by a
/// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
library number_format_test;
@@ -94,7 +93,7 @@
if (!testNumbersWeCannotReadBack.containsKey(x)) {
var readBack = number.parse(formatted);
// Even among ones we can read back, we can't test NaN for equality.
- if (allTestNumbers[x].isNaN) {
+ if (allTestNumbers[x]!.isNaN) {
expect(readBack.isNaN, isTrue);
} else {
expect(readBack, allTestNumbers[x]);
diff --git a/test/number_format_vm_test.dart b/test/number_format_vm_test.dart
index 6bc8e39..8c04b58 100644
--- a/test/number_format_vm_test.dart
+++ b/test/number_format_vm_test.dart
@@ -1,7 +1,6 @@
/// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
/// for details. All rights reserved. Use of this source code is governed by a
/// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Number tests for the VM - includes numbers that can only be compiled for the
/// VM.
diff --git a/test/number_format_web_test.dart b/test/number_format_web_test.dart
index 293e9f7..86db381 100644
--- a/test/number_format_web_test.dart
+++ b/test/number_format_web_test.dart
@@ -1,7 +1,6 @@
/// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
/// for details. All rights reserved. Use of this source code is governed by a
/// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Number format tests for the web - excludes numbers too big to compile for
/// the web.
diff --git a/test/number_test_data.dart b/test/number_test_data.dart
index c3549d4..10ed7ad 100644
--- a/test/number_test_data.dart
+++ b/test/number_test_data.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test data for numeric formatting from a large set of locales.
///
diff --git a/test/plural_test.dart b/test/plural_test.dart
index 3ad91a3..1aa60b6 100644
--- a/test/plural_test.dart
+++ b/test/plural_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test plurals without translation.
///
@@ -193,10 +192,8 @@
test('Check null howMany', () {
expect(plural(0, null), '0:Zero');
- expect(() => plural(null, null),
- anyOf(throwsArgumentError, throwsA(isA<AssertionError>())));
- expect(() => plural(null, 'ru'),
- anyOf(throwsArgumentError, throwsA(isA<AssertionError>())));
+ expect(() => plural(null, null), throwsA(isA<Error>()));
+ expect(() => plural(null, 'ru'), throwsA(isA<Error>()));
});
verifyWithPrecision('1 dollar', 'en', 1, 0);
diff --git a/test/scorbeysund_timezone_test.dart b/test/scorbeysund_timezone_test.dart
index 1463f08..873b75d 100644
--- a/test/scorbeysund_timezone_test.dart
+++ b/test/scorbeysund_timezone_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing while the system time zone is set to
/// America/Scoresbysund.
diff --git a/test/timezone_local_even_test_helper.dart b/test/timezone_local_even_test_helper.dart
index 46d6c81..7df4ea6 100644
--- a/test/timezone_local_even_test_helper.dart
+++ b/test/timezone_local_even_test_helper.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing using locale data directly imported.
///
diff --git a/test/timezone_test_core.dart b/test/timezone_test_core.dart
index d6e9285..10d8185 100644
--- a/test/timezone_test_core.dart
+++ b/test/timezone_test_core.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing while the system time zone is set.
import 'dart:convert';
@@ -16,7 +15,7 @@
/// Test for a particular timezone. In order to verify that we are in fact
/// running in that time zone, verify that the DateTime offset is one of the
/// expected values.
-void testTimezone(String timezoneName, {int expectedUtcOffset}) {
+void testTimezone(String timezoneName, {int? expectedUtcOffset}) {
// Define the environment variable 'PACKAGE_DIR=<directory>' to indicate the
// root of the Intl package. If it is not provided, we assume that the root of
// the Intl package is the current directory.
diff --git a/test/utc_timezone_test.dart b/test/utc_timezone_test.dart
index d085e7b..7c7d494 100644
--- a/test/utc_timezone_test.dart
+++ b/test/utc_timezone_test.dart
@@ -1,7 +1,6 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.9
/// Test date formatting and parsing while the system time zone is set to
/// UTC.