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

Unified Diff: dart/tests/language/try_catch_on_syntax_test.dart

Issue 10857013: Support for new catch syntax in dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 4 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 | « dart/tests/language/language_dart2js.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/language/try_catch_on_syntax_test.dart
diff --git a/dart/tests/language/try_catch_on_syntax_test.dart b/dart/tests/language/try_catch_on_syntax_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..702854891f32378dd72f29dfc6bb6d0e6e5b126a
--- /dev/null
+++ b/dart/tests/language/try_catch_on_syntax_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2011, 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.
+
+class MyException { }
+
+class MyException1 extends MyException { }
+
+class MyException2 extends MyException { }
+
+class TryCatchTest {
+ static void test1() {
+ var foo = 0;
+ try {
+ throw new MyException1();
+ }
+ on MyException3 catch (e) { } /// 01: compile-time error
+ on on MyException2 catch (e) { } /// 02: compile-time error
+ catch MyException2 catch (e) { } /// 03: compile-time error
+ catch catch catch (e) { } /// 04: compile-time error
+ on (e) { } /// 05: compile-time error
+ catch MyException2 catch (e) { } /// 06: compile-time error
+ on MyException2 catch (e) {
+ foo = 1;
+ } on MyException1 catch (e) {
+ foo = 2;
+ } on MyException catch (e) {
+ foo = 3;
+ }
+ Expect.equals(2, foo);
+ }
+
+ static void testMain() {
+ test1();
+ }
+}
+
+main() {
+ TryCatchTest.testMain();
+}
« no previous file with comments | « dart/tests/language/language_dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698