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

Side by Side Diff: tests/language_strong/stacktrace_rethrow_error_test.dart

Issue 2774783002: Re-land "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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 4
5 class SubclassOfError extends Error {} 5 class SubclassOfError extends Error {}
6 6
7 fail() => throw "Fail"; 7 fail() => throw "Fail";
8 8
9 // == Rethrow, skipping through typed handlers. == 9 // == Rethrow, skipping through typed handlers. ==
10 10
11 aa1() { 11 aa1() {
12 try { 12 try {
13 bb1(); 13 bb1();
14 fail(); 14 fail();
15 } catch(error 15 } catch (error
16 , stacktrace // //# withtraceparameter: ok 16 , stacktrace // //# withtraceparameter: ok
17 ) { 17 ) {
18 expectTrace(['gg1', 'ff1', 'ee1', 'dd1', 'cc1', 'bb1', 'aa1'], error.stackTr ace); 18 expectTrace(
19 ['gg1', 'ff1', 'ee1', 'dd1', 'cc1', 'bb1', 'aa1'], error.stackTrace);
19 expectTrace(['gg1', 'ff1', 'ee1', 'dd1', 'cc1', 'bb1', 'aa1'], stacktrace); // //# withtraceparameter: continued 20 expectTrace(['gg1', 'ff1', 'ee1', 'dd1', 'cc1', 'bb1', 'aa1'], stacktrace); // //# withtraceparameter: continued
20 } 21 }
21 } 22 }
22 23
23 bb1() => cc1(); 24 bb1() => cc1();
24 25
25 cc1() { 26 cc1() {
26 try { 27 try {
27 dd1(); 28 dd1();
28 } on String catch(e) { 29 } on String catch (e) {
29 fail(); 30 fail();
30 } on int catch(e) { 31 } on int catch (e) {
31 fail(); 32 fail();
32 } 33 }
33 } 34 }
34 35
35 dd1() => ee1(); 36 dd1() => ee1();
36 37
37 ee1() { 38 ee1() {
38 try { 39 try {
39 ff1(); 40 ff1();
40 } catch(e) { 41 } catch (e) {
41 rethrow; 42 rethrow;
42 } 43 }
43 } 44 }
44 45
45 ff1() => gg1(); 46 ff1() => gg1();
46 47
47 gg1() => throw new SubclassOfError(); 48 gg1() => throw new SubclassOfError();
48 49
49 // == Rethrow, rethrow again in typed handler. == 50 // == Rethrow, rethrow again in typed handler. ==
50 51
51 aa2() { 52 aa2() {
52 try { 53 try {
53 bb2(); 54 bb2();
54 fail(); 55 fail();
55 } catch(error 56 } catch (error
56 , stacktrace // //# withtraceparameter: continued 57 , stacktrace // //# withtraceparameter: continued
57 ) { 58 ) {
58 expectTrace(['gg2', 'ff2', 'ee2', 'dd2', 'cc2', 'bb2', 'aa2'], error.stackTr ace); 59 expectTrace(
60 ['gg2', 'ff2', 'ee2', 'dd2', 'cc2', 'bb2', 'aa2'], error.stackTrace);
59 expectTrace(['gg2', 'ff2', 'ee2', 'dd2', 'cc2', 'bb2', 'aa2'], stacktrace); // //# withtraceparameter: continued 61 expectTrace(['gg2', 'ff2', 'ee2', 'dd2', 'cc2', 'bb2', 'aa2'], stacktrace); // //# withtraceparameter: continued
60 } 62 }
61 } 63 }
62 64
63 bb2() => cc2(); 65 bb2() => cc2();
64 66
65 cc2() { 67 cc2() {
66 try { 68 try {
67 dd2(); 69 dd2();
68 } on SubclassOfError catch(e) { 70 } on SubclassOfError catch (e) {
69 rethrow; 71 rethrow;
70 } on int catch(e) { 72 } on int catch (e) {
71 fail(); 73 fail();
72 } 74 }
73 } 75 }
74 76
75 dd2() => ee2(); 77 dd2() => ee2();
76 78
77 ee2() { 79 ee2() {
78 try { 80 try {
79 ff2(); 81 ff2();
80 } catch(e) { 82 } catch (e) {
81 rethrow; 83 rethrow;
82 } 84 }
83 } 85 }
84 86
85 ff2() => gg2(); 87 ff2() => gg2();
86 88
87 gg2() => throw new SubclassOfError(); 89 gg2() => throw new SubclassOfError();
88 90
89 // == Rethrow, with intervening catch without a trace parameter. 91 // == Rethrow, with intervening catch without a trace parameter.
90 92
91 aa3() { 93 aa3() {
92 try { 94 try {
93 bb3(); 95 bb3();
94 fail(); 96 fail();
95 } catch(error 97 } catch (error
96 , stacktrace // //# withtraceparameter: continued 98 , stacktrace // //# withtraceparameter: continued
97 ) { 99 ) {
98 expectTrace(['gg3', 'ff3', 'ee3', 'dd3', 'cc3', 'bb3', 'aa3'], error.stackTr ace); 100 expectTrace(
101 ['gg3', 'ff3', 'ee3', 'dd3', 'cc3', 'bb3', 'aa3'], error.stackTrace);
99 expectTrace(['cc3', 'bb3', 'aa3'], stacktrace); // //# withtraceparameter: c ontinued 102 expectTrace(['cc3', 'bb3', 'aa3'], stacktrace); // //# withtraceparameter: c ontinued
100 } 103 }
101 } 104 }
102 105
103 bb3() => cc3(); 106 bb3() => cc3();
104 107
105 cc3() { 108 cc3() {
106 try { 109 try {
107 dd3(); 110 dd3();
108 } catch(e) { 111 } catch (e) {
109 throw e; 112 throw e;
110 } 113 }
111 } 114 }
112 115
113 dd3() => ee3(); 116 dd3() => ee3();
114 117
115 ee3() { 118 ee3() {
116 try { 119 try {
117 ff3(); 120 ff3();
118 } catch(e) { 121 } catch (e) {
119 rethrow; 122 rethrow;
120 } 123 }
121 } 124 }
122 125
123 ff3() => gg3(); 126 ff3() => gg3();
124 127
125 gg3() => throw new SubclassOfError(); 128 gg3() => throw new SubclassOfError();
126 129
127 expectTrace(functionNames, stacktrace) { 130 expectTrace(functionNames, stacktrace) {
128 // Note we don't expect functionNames to cover the whole trace, only the 131 // Note we don't expect functionNames to cover the whole trace, only the
(...skipping 16 matching lines...) Expand all
145 actualIndex++; 148 actualIndex++;
146 expectedIndex++; 149 expectedIndex++;
147 } 150 }
148 } 151 }
149 } 152 }
150 153
151 main() { 154 main() {
152 aa1(); 155 aa1();
153 aa2(); 156 aa2();
154 aa3(); 157 aa3();
155 } 158 }
OLDNEW
« no previous file with comments | « tests/language_strong/setter_override_test.dart ('k') | tests/language_strong/static_field_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698