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

Unified Diff: tests/corelib_strong/int_parse_radix_test.dart

Issue 2774783002: Re-land "Format all multitests" (Closed)
Patch Set: Created 3 years, 9 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_strong/int_modulo_arith_test.dart ('k') | tests/corelib_strong/integer_to_string_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib_strong/int_parse_radix_test.dart
diff --git a/tests/corelib_strong/int_parse_radix_test.dart b/tests/corelib_strong/int_parse_radix_test.dart
index d44c50ef3515211c3dc06bd7fd2b57875936ea62..eee845f9c6753d63aa494ed9565ad08b0a9ed765 100644
--- a/tests/corelib_strong/int_parse_radix_test.dart
+++ b/tests/corelib_strong/int_parse_radix_test.dart
@@ -10,7 +10,7 @@ void main() {
assert((checkedMode = true));
const String oneByteWhiteSpace = "\x09\x0a\x0b\x0c\x0d\x20"
"\x85" //# 01: ok
- "\xa0";
+ "\xa0";
const String whiteSpace = "$oneByteWhiteSpace\u1680"
"\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a"
"\u2028\u2029\u202f\u205f\u3000\ufeff";
@@ -25,10 +25,10 @@ void main() {
void testParse(int result, String radixString, int radix) {
var m = "$radixString/$radix->$result";
- Expect.equals(result,
- int.parse(radixString.toLowerCase(), radix: radix), m);
- Expect.equals(result,
- int.parse(radixString.toUpperCase(), radix: radix), m);
+ Expect.equals(
+ result, int.parse(radixString.toLowerCase(), radix: radix), m);
+ Expect.equals(
+ result, int.parse(radixString.toUpperCase(), radix: radix), m);
Expect.equals(result, int.parse(" $radixString", radix: radix), m);
Expect.equals(result, int.parse("$radixString ", radix: radix), m);
Expect.equals(result, int.parse(" $radixString ", radix: radix), m);
@@ -40,14 +40,20 @@ void main() {
Expect.equals(-result, int.parse(" -$radixString", radix: radix), m);
Expect.equals(-result, int.parse("-$radixString ", radix: radix), m);
Expect.equals(-result, int.parse(" -$radixString ", radix: radix), m);
- Expect.equals(result, int.parse(
- "$oneByteWhiteSpace$radixString$oneByteWhiteSpace", radix: radix), m);
- Expect.equals(-result, int.parse(
- "$oneByteWhiteSpace-$radixString$oneByteWhiteSpace", radix: radix), m);
- Expect.equals(result, int.parse(
- "$whiteSpace$radixString$whiteSpace", radix: radix), m);
- Expect.equals(-result, int.parse(
- "$whiteSpace-$radixString$whiteSpace", radix: radix), m);
+ Expect.equals(
+ result,
+ int.parse("$oneByteWhiteSpace$radixString$oneByteWhiteSpace",
+ radix: radix),
+ m);
+ Expect.equals(
+ -result,
+ int.parse("$oneByteWhiteSpace-$radixString$oneByteWhiteSpace",
+ radix: radix),
+ m);
+ Expect.equals(result,
+ int.parse("$whiteSpace$radixString$whiteSpace", radix: radix), m);
+ Expect.equals(-result,
+ int.parse("$whiteSpace-$radixString$whiteSpace", radix: radix), m);
Expect.equals(result, int.parse("$zeros$radixString", radix: radix), m);
Expect.equals(result, int.parse("+$zeros$radixString", radix: radix), m);
@@ -86,20 +92,22 @@ void main() {
Expect.equals(1, int.parse("+1", radix: 2));
void testFails(String source, int radix) {
- Expect.throws(() { throw int.parse(source, radix: radix,
- onError: (s) { throw "FAIL"; }); },
- isFail,
- "$source/$radix");
+ Expect.throws(() {
+ throw int.parse(source, radix: radix, onError: (s) {
+ throw "FAIL";
+ });
+ }, isFail, "$source/$radix");
Expect.equals(-999, int.parse(source, radix: radix, onError: (s) => -999));
}
+
for (int i = 2; i < 36; i++) {
var char = i.toRadixString(36);
testFails(char.toLowerCase(), i);
testFails(char.toUpperCase(), i);
}
testFails("", 2);
- testFails("+ 1", 2); // No space between sign and digits.
- testFails("- 1", 2); // No space between sign and digits.
+ testFails("+ 1", 2); // No space between sign and digits.
+ testFails("- 1", 2); // No space between sign and digits.
testFails("0x", null);
for (int i = 2; i <= 33; i++) {
// No 0x specially allowed.
@@ -116,7 +124,7 @@ void main() {
}
// In checked mode, it's always a TypeError.
Expect.throws(() => int.parse(source, radix: radix, onError: (s) => 0),
- (e) => e is TypeError || e is CastError);
+ (e) => e is TypeError || e is CastError);
}
testBadTypes(9, 10);
@@ -127,7 +135,7 @@ void main() {
testBadArguments(String source, int radix) {
// If the types match, it should be an ArgumentError of some sort.
Expect.throws(() => int.parse(source, radix: radix, onError: (s) => 0),
- (e) => e is ArgumentError);
+ (e) => e is ArgumentError);
}
testBadArguments("0", -1);
« no previous file with comments | « tests/corelib_strong/int_modulo_arith_test.dart ('k') | tests/corelib_strong/integer_to_string_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698