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

Unified Diff: tests/corelib_2/int_parse_with_limited_ints_test.dart

Issue 2986193002: Fix test int_parse_with_limited_ints_test in checked and strong modes (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « tests/corelib_2/corelib_2.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib_2/int_parse_with_limited_ints_test.dart
diff --git a/tests/corelib_2/int_parse_with_limited_ints_test.dart b/tests/corelib_2/int_parse_with_limited_ints_test.dart
index c1b67ddb2966f93ff374b5eb78bbb59a8dbef25c..2fab27edc1f4eff130c25ed482c2e0b76c2ccace 100644
--- a/tests/corelib_2/int_parse_with_limited_ints_test.dart
+++ b/tests/corelib_2/int_parse_with_limited_ints_test.dart
@@ -9,7 +9,8 @@
import "package:expect/expect.dart";
main() {
- var returnError = (_) => "ERROR";
+ const int ERROR = 42;
+ var returnError = (_) => ERROR;
Expect.equals(0, int.parse("0"));
Expect.equals(1, int.parse("1"));
@@ -20,9 +21,10 @@ main() {
Expect.equals(-0x7fffffffffffffff, int.parse("-0x7fffffffffffffff"));
Expect.equals(-0x7fffffffffffffff - 1, int.parse("-0x8000000000000000"));
- Expect.equals("ERROR", int.parse("0x8000000000000000", onError: returnError));
- Expect.equals(
- "ERROR", int.parse("-0x8000000000000001", onError: returnError));
+ Expect.throws(
+ () => int.parse("0x8000000000000000"), (e) => e is FormatException);
+ Expect.equals(ERROR, int.parse("0x8000000000000000", onError: returnError));
+ Expect.equals(ERROR, int.parse("-0x8000000000000001", onError: returnError));
Expect.equals(8999999999999999999, int.parse("8999999999999999999"));
Expect.equals(-8999999999999999999, int.parse("-8999999999999999999"));
@@ -30,14 +32,10 @@ main() {
Expect.equals(-9223372036854775807, int.parse("-9223372036854775807"));
Expect.equals(-9223372036854775807 - 1, int.parse("-9223372036854775808"));
- Expect.equals(
- "ERROR", int.parse("9223372036854775808", onError: returnError));
- Expect.equals(
- "ERROR", int.parse("9223372036854775809", onError: returnError));
- Expect.equals(
- "ERROR", int.parse("-9223372036854775809", onError: returnError));
- Expect.equals(
- "ERROR", int.parse("10000000000000000000", onError: returnError));
+ Expect.equals(ERROR, int.parse("9223372036854775808", onError: returnError));
+ Expect.equals(ERROR, int.parse("9223372036854775809", onError: returnError));
+ Expect.equals(ERROR, int.parse("-9223372036854775809", onError: returnError));
+ Expect.equals(ERROR, int.parse("10000000000000000000", onError: returnError));
Expect.equals(
0x7fffffffffffffff,
@@ -56,25 +54,25 @@ main() {
radix: 2));
Expect.equals(
- "ERROR",
+ ERROR,
int.parse(
"1000000000000000000000000000000000000000000000000000000000000000",
radix: 2,
onError: returnError));
Expect.equals(
- "ERROR",
+ ERROR,
int.parse(
"1111111111111111111111111111111111111111111111111111111111111110",
radix: 2,
onError: returnError));
Expect.equals(
- "ERROR",
+ ERROR,
int.parse(
"1111111111111111111111111111111111111111111111111111111111111111",
radix: 2,
onError: returnError));
Expect.equals(
- "ERROR",
+ ERROR,
int.parse(
"-1000000000000000000000000000000000000000000000000000000000000001",
radix: 2,
« no previous file with comments | « tests/corelib_2/corelib_2.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698