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

Unified Diff: tests/language/src/TryCatchSyntaxTest.dart

Issue 9372015: Rewrite the negative try-catch tests into a single multi test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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/language/src/TryCatch9NegativeTest.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/src/TryCatchSyntaxTest.dart
diff --git a/tests/language/src/TryCatchSyntaxTest.dart b/tests/language/src/TryCatchSyntaxTest.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e37d25bb799fa79f685212056107767a8e2fd352
--- /dev/null
+++ b/tests/language/src/TryCatchSyntaxTest.dart
@@ -0,0 +1,41 @@
+// 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.
+
+main() {
+ testMissingCatch();
+ testMissingTry();
+ testDuplicateCatchVariable();
+ testIllegalFinally();
+ testIllegalCatch();
+ testIllegalRethrow();
+}
+
+testMissingCatch() {
+ try { } /// 01: compile-time error
+}
+
+testMissingTry() {
+ catch (Exception e) { } /// 02: compile-time error
+ catch (Exception e, StackTrace trace) { } /// 03: compile-time error
+ finally { } /// 04: compile-time error
+}
+
+testDuplicateCatchVariable() {
+ try { } catch (Exception e, StackTrace e) { } /// 05: compile-time error
+}
+
+testIllegalFinally() {
+ try { } finally (e) { } /// 06: compile-time error
+}
+
+testIllegalCatch() {
+ try { } catch () { } /// 07: compile-time error
+ try { } catch (e) { } /// 08: compile-time error
+ try { } catch (MammaMia e) { } /// 09: compile-time error
+}
+
+testIllegalRethrow() {
+ try { throw; } catch (var e) { } /// 10: compile-time error
+ try { } catch (var e) { } finally { throw; } /// 11: compile-time error
+}
« no previous file with comments | « tests/language/src/TryCatch9NegativeTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698