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

Unified Diff: tests/corelib/int_parse_radix_bad_handler_test.dart

Issue 1950413002: Split int_parse_radix_test into strong and non-strong parts. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/corelib.status ('k') | tests/corelib/int_parse_radix_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/int_parse_radix_bad_handler_test.dart
diff --git a/tests/corelib/int_parse_radix_bad_handler_test.dart b/tests/corelib/int_parse_radix_bad_handler_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..58009fa7fce572e08f4efa3ec937051a8f02281f
--- /dev/null
+++ b/tests/corelib/int_parse_radix_bad_handler_test.dart
@@ -0,0 +1,15 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+void main() {
+ // If handleError isn't an unary function, and it's called, it also throws
+ // (either TypeError in checked mode, or some failure in unchecked mode).
+
+ // These are compile time errors for strong mode.
+ Expect.throws(() => int.parse("9", radix: 8, onError: "not a function"));
+ Expect.throws(() => int.parse("9", radix: 8, onError: () => 42));
+ Expect.throws(() => int.parse("9", radix: 8, onError: (v1, v2) => 42));
+}
« no previous file with comments | « tests/corelib/corelib.status ('k') | tests/corelib/int_parse_radix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698