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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 // Dart test program for testing try/catch statement without any exceptions 4 // Dart test program for testing try/catch statement without any exceptions
5 // being thrown. 5 // being thrown.
6 // VMOptions=--optimization-counter-threshold=100 --no-background-compilation -- enable-inlining-annotations 6 // VMOptions=--optimization-counter-threshold=100 --no-background-compilation -- enable-inlining-annotations
7 7
8 // Test optional parameters updated inside try-catch 8 // Test optional parameters updated inside try-catch
9 9
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
11 11
12 const noInline = "NeverInline"; 12 const noInline = "NeverInline";
13 13
14 @noInline 14 @noInline
15 m1(int b) { 15 m1(int b) {
16 if (b == 1) throw 123; 16 if (b == 1) throw 123;
17 } 17 }
18 18
19
20 @noInline 19 @noInline
21 m2(int b) { 20 m2(int b) {
22 if (b == 2) throw 456; 21 if (b == 2) throw 456;
23 } 22 }
24 23
25
26 @noInline 24 @noInline
27 test1(int b, [int state = 0]) { 25 test1(int b, [int state = 0]) {
28 try { 26 try {
29 state++; 27 state++;
30 m1(b); 28 m1(b);
31 state++; 29 state++;
32 m2(b); 30 m2(b);
33 state++; 31 state++;
34 } on dynamic catch (e, s) { 32 } on dynamic catch (e, s) {
35 if (b == 1 && state != 1) throw "fail1"; 33 if (b == 1 && state != 1) throw "fail1";
(...skipping 13 matching lines...) Expand all
49 m1(b); 47 m1(b);
50 state++; 48 state++;
51 m2(b); 49 m2(b);
52 state++; 50 state++;
53 } on dynamic catch (e, s) { 51 } on dynamic catch (e, s) {
54 if (b == 1 && state != 1) throw "fail1"; 52 if (b == 1 && state != 1) throw "fail1";
55 if (b == 2 && state != 2) throw "fail2"; 53 if (b == 2 && state != 2) throw "fail2";
56 if (b == 3 && state != 3) throw "fail3"; 54 if (b == 3 && state != 3) throw "fail3";
57 if (s is! StackTrace) throw "fail4"; 55 if (s is! StackTrace) throw "fail4";
58 return e; 56 return e;
59 } 57 }
60 return "no throw"; 58 return "no throw";
61 } 59 }
62 60
63 main() { 61 main() {
64 for (var i=0; i<300; i++) { 62 for (var i = 0; i < 300; i++) {
65 Expect.equals("no throw", test1(0)); 63 Expect.equals("no throw", test1(0));
66 } 64 }
67 Expect.equals("no throw", test1(0)); 65 Expect.equals("no throw", test1(0));
68 Expect.equals(123, test1(1)); 66 Expect.equals(123, test1(1));
69 Expect.equals(456, test1(2)); 67 Expect.equals(456, test1(2));
70 68
71 for (var i=0; i<300; i++) { 69 for (var i = 0; i < 300; i++) {
72 Expect.equals("no throw", test2(0)); 70 Expect.equals("no throw", test2(0));
73 } 71 }
74 Expect.equals("no throw", test2(0)); 72 Expect.equals("no throw", test2(0));
75 Expect.equals(123, test2(1)); 73 Expect.equals(123, test2(1));
76 Expect.equals(456, test2(2)); 74 Expect.equals(456, test2(2));
77 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698