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

Side by Side Diff: tests/language/vm/causal_async_exception_stack2_test.dart

Issue 2694213002: Revert "Improvements to causal async stack traces" (Closed)
Patch Set: Created 3 years, 10 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
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'package:unittest/unittest.dart';
6
7 foo3() async => throw "foo";
8 bar3() async => throw "bar";
9
10 foo2() async => foo3();
11 bar2() async => bar3();
12
13 foo() async => foo2();
14 bar() async => bar2();
15
16 test1() async {
17 // test1 -> foo -> foo2 -> foo3
18 // test1 -> bar -> bar2 -> bar3
19 // These run interleaved, check their stack traces don't become mixed.
20 var a = foo();
21 var b = bar();
22
23 try {
24 await a;
25 } catch(e, st) {
26 // st has foo,2,3 and not bar,2,3.
27 expect(st.toString(), stringContainsInOrder([
28 'foo3',
29 '<asynchronous suspension>',
30 'foo2',
31 '<asynchronous suspension>',
32 'foo',
33 '<asynchronous suspension>',
34 'test1',
35 ]));
36 expect(st.toString().contains('bar'), isFalse);
37 }
38
39 try {
40 await b;
41 } catch(e, st) {
42 // st has bar,2,3 but not foo,2,3
43 expect(st.toString(), stringContainsInOrder([
44 'bar3',
45 '<asynchronous suspension>',
46 'bar2',
47 '<asynchronous suspension>',
48 'bar',
49 '<asynchronous suspension>',
50 'test1',
51 ]));
52 expect(st.toString().contains('foo'), isFalse);
53 }
54 }
55
56 test2() async {
57 // test2 -> foo -> foo2 -> foo3
58 // test2 -> bar -> bar2 -> bar3
59 // These run sequentially, check the former stack trace didn't get linked to
60 // from the latter stack trace.
61
62 try {
63 await foo();
64 } catch(e, st) {
65 // st has foo,2,3 but not bar,2,3
66 expect(st.toString(), stringContainsInOrder([
67 'foo3',
68 '<asynchronous suspension>',
69 'foo2',
70 '<asynchronous suspension>',
71 'foo',
72 '<asynchronous suspension>',
73 'test2',
74 ]));
75 expect(st.toString().contains('bar'), isFalse);
76 }
77
78 try {
79 await bar();
80 } catch(e, st) {
81 // st has bar,2,3 but not foo,2,3
82 expect(st.toString(), stringContainsInOrder([
83 'bar3',
84 '<asynchronous suspension>',
85 'bar2',
86 '<asynchronous suspension>',
87 'bar',
88 '<asynchronous suspension>',
89 'test2',
90 ]));
91 expect(st.toString().contains('foo'), isFalse);
92 }
93 }
94
95 main() async {
96 await test1();
97 await test2();
98 }
OLDNEW
« no previous file with comments | « tests/language/language.status ('k') | tests/language/vm/causal_async_exception_stack_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698