Index: tests/corelib/int_parse_radix_test.dart |
diff --git a/tests/corelib/int_parse_radix_test.dart b/tests/corelib/int_parse_radix_test.dart |
index 9473631bebbf955ebdb998988cd04fd6ac07e1b6..5b9f0a22b5c9ab3a952b6b701e7beaaff3d78936 100644 |
--- a/tests/corelib/int_parse_radix_test.dart |
+++ b/tests/corelib/int_parse_radix_test.dart |
@@ -5,9 +5,17 @@ |
import "package:expect/expect.dart"; |
import "dart:math" show pow; |
+final bool isCheckedMode = (() { |
+ try { |
+ var i = 42; |
+ String s = i; |
+ } on TypeError catch (e) { |
+ return true; |
+ } |
+ return false; |
+})(); |
sra1
2017/05/24 01:30:46
delete
eernst
2017/07/07 08:50:29
Done.
|
+ |
void main() { |
- bool checkedMode = false; |
- assert((checkedMode = true)); |
const String oneByteWhiteSpace = "\x09\x0a\x0b\x0c\x0d\x20" |
"\x85" // //# 01: ok |
"\xa0"; |
@@ -116,13 +124,13 @@ void main() { |
} |
testBadTypes(var source, var radix) { |
- if (!checkedMode) { |
+ if (!typeAssertionsEnabled) { |
// No promises on what error is thrown if the type doesn't match. |
// Likely either ArgumentError or NoSuchMethodError. |
Expect.throws(() => int.parse(source, radix: radix, onError: (s) => 0)); |
return; |
} |
- // In checked mode, it's always a TypeError. |
+ // With type assertions enabled we can be more precise. |
Expect.throws(() => int.parse(source, radix: radix, onError: (s) => 0), |
(e) => e is TypeError || e is CastError); |
} |