| 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
|
| +}
|
|
|