| Index: tests/compiler/dart2js/kernel/try_catch_test.dart
|
| diff --git a/tests/compiler/dart2js/kernel/try_catch_test.dart b/tests/compiler/dart2js/kernel/try_catch_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..972667c7b6c53845166c0eac9a58c0b79731caba
|
| --- /dev/null
|
| +++ b/tests/compiler/dart2js/kernel/try_catch_test.dart
|
| @@ -0,0 +1,96 @@
|
| +// Copyright (c) 2016, 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:test/test.dart';
|
| +
|
| +import 'helper.dart' show check;
|
| +
|
| +main() {
|
| + test('try catch', () {
|
| + String code = '''
|
| +main() {
|
| + try {
|
| + print('hi');
|
| + } catch (e, s) {
|
| + print(e);
|
| + print(s);
|
| + print('bye');
|
| + }
|
| +}''';
|
| + return check(code);
|
| + });
|
| +
|
| + test('try omit catch', () {
|
| + String code = '''
|
| +main() {
|
| + try {
|
| + print('hi');
|
| + } on ArgumentError {
|
| + print('howdy');
|
| + }
|
| +}''';
|
| + return check(code);
|
| + });
|
| +
|
| + test('try finally', () {
|
| + String code = '''
|
| +main() {
|
| + try {
|
| + print('hi');
|
| + } finally {
|
| + print('bye');
|
| + }
|
| +}''';
|
| + return check(code);
|
| + });
|
| +
|
| + test('try catch finally', () {
|
| + String code = '''
|
| +main() {
|
| + try {
|
| + print('hi');
|
| + } catch(e) {
|
| + print('howdy');
|
| + } finally {
|
| + print('bye');
|
| + }
|
| +}''';
|
| + return check(code);
|
| + });
|
| +
|
| + test('try multi catch', () {
|
| + String code = '''
|
| +main() {
|
| + try {
|
| + print('hi');
|
| + } on String catch(e) {
|
| + print('hola');
|
| + } on int catch(e) {
|
| + print('halo');
|
| + } catch (e) {
|
| + print('howdy');
|
| + }
|
| +}''';
|
| + return check(code);
|
| + });
|
| +
|
| + test('try multi-catch finally', () {
|
| + String code = '''
|
| +main() {
|
| + try {
|
| + print('hi');
|
| + } on String catch(e) {
|
| + print('hola');
|
| + } on int catch(e) {
|
| + print('halo');
|
| + } catch (e) {
|
| + print('howdy');
|
| + } finally {
|
| + print('bye');
|
| + }
|
| +}''';
|
| + return check(code);
|
| + });
|
| +}
|
| +
|
|
|