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

Side by Side Diff: tests/language/try_catch_test.dart

Issue 2770063002: Revert "Format all multitests" (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation 4 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation
5 5
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 class MyException {} 8 class MyException { }
9 9
10 class MyException1 extends MyException {} 10 class MyException1 extends MyException { }
11 11
12 class MyException2 extends MyException {} 12 class MyException2 extends MyException { }
13 13
14 class TryCatchTest { 14 class TryCatchTest {
15 static void test1() { 15 static void test1() {
16 var foo = 0; 16 var foo = 0;
17 try { 17 try {
18 throw new MyException1(); 18 throw new MyException1();
19 } on MyException2 catch (e) { 19 } on MyException2 catch (e) {
20 foo = 1; 20 foo = 1;
21 } on MyException1 catch (e) { 21 } on MyException1 catch (e) {
22 foo = 2; 22 foo = 2;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } on int { 135 } on int {
136 e = "i"; 136 e = "i";
137 } 137 }
138 Expect.equals("s", e); 138 Expect.equals("s", e);
139 } 139 }
140 140
141 static void test10() { 141 static void test10() {
142 try { 142 try {
143 throw "up"; 143 throw "up";
144 } on String catch (e) { 144 } on String catch (e) {
145 var e = 1; // ok, shadows exception variable. 145 var e = 1; // ok, shadows exception variable.
146 Expect.equals(1, e); 146 Expect.equals(1, e);
147 } 147 }
148 } 148 }
149 149
150 static void test11() { 150 static void test11() {
151 var e0 = 11; 151 var e0 = 11;
152 try { 152 try {
153 throw "up"; 153 throw "up";
154 } on int catch (e0) { 154 } on int catch (e0) {
155 Expect.fail("unreachable"); 155 Expect.fail("unreachable");
(...skipping 10 matching lines...) Expand all
166 } catch (e) { 166 } catch (e) {
167 Expect.equals("up", e); 167 Expect.equals("up", e);
168 } on String catch (e) { 168 } on String catch (e) {
169 // Compile-time constants in unreachable catch blocks are still 169 // Compile-time constants in unreachable catch blocks are still
170 // compiled. 170 // compiled.
171 const y = x[0]; // //# 01: compile-time error 171 const y = x[0]; // //# 01: compile-time error
172 Expect.fail("unreachable"); 172 Expect.fail("unreachable");
173 } 173 }
174 } 174 }
175 175
176
176 static void testMain() { 177 static void testMain() {
177 test1(); 178 test1();
178 test2(); 179 test2();
179 test3(); 180 test3();
180 test4(); 181 test4();
181 test5(); 182 test5();
182 test6(); 183 test6();
183 test7(); 184 test7();
184 test8(); 185 test8();
185 test9(); 186 test9();
186 test10(); 187 test10();
187 test11(); 188 test11();
188 test12(); 189 test12();
189 } 190 }
190 } 191 }
191 192
192 main() { 193 main() {
193 for (var i = 0; i < 20; i++) { 194 for (var i = 0; i < 20; i++) {
194 TryCatchTest.testMain(); 195 TryCatchTest.testMain();
195 } 196 }
196 } 197 }
OLDNEW
« no previous file with comments | « tests/language/try_catch_on_syntax_test.dart ('k') | tests/language/type_check_const_function_typedef2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698