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

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

Issue 996103002: Fix handling of lazy and and or in async functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update unittest Created 5 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 | Annotate | Revision Log
« no previous file with comments | « tests/compiler/dart2js/async_await_js_transform_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, 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 import "package:expect/expect.dart";
5 import "package:async_helper/async_helper.dart";
6
7 test1() async {
8 Expect.isFalse(await confuse(false) && await confuse(false));
9 Expect.isFalse(await confuse(false) && await confuse(true));
10 Expect.isFalse(await confuse(true) && await confuse(false));
11 Expect.isTrue(await confuse(true) && await confuse(true));
12
13 Expect.isFalse(await confuse(false) || await confuse(false));
14 Expect.isTrue(await confuse(false) || await confuse(true));
15 Expect.isTrue(await confuse(true) || await confuse(false));
16 Expect.isTrue(await confuse(true) || await confuse(true));
17 }
18
19 String trace;
20
21 traceA(x) {
22 trace += "a";
23 return x;
24 }
25 traceB(x) {
26 trace += "b";
27 return x;
28 }
29
30 testEvaluation(void fn()) async {
31 trace = "";
32 await fn();
33 }
34
35 test2() async {
36 await testEvaluation(() async {
37 Expect.isFalse(await confuse(traceA(false)) && await confuse(traceB(false))) ;
floitsch 2015/03/13 08:55:40 long line.
sigurdm 2015/05/08 07:44:52 Done.
38 Expect.equals("a", trace);
39 });
40 await testEvaluation(() async {
41 Expect.isFalse(await confuse(traceA(false)) && await confuse(traceB(true)));
42 Expect.equals("a", trace);
43 });
44 await testEvaluation(() async {
45 Expect.isFalse(await confuse(traceA(true)) && await confuse(traceB(false)));
46 Expect.equals("ab", trace);
47 });
48 await testEvaluation(() async {
49 Expect.isTrue(await confuse(traceA(true)) && await confuse(traceB(true)));
50 Expect.equals("ab", trace);
51 });
52
53 await testEvaluation(() async {
54 Expect.isFalse(await confuse(traceA(false)) || await confuse(traceB(false))) ;
floitsch 2015/03/13 08:55:40 long line.
sigurdm 2015/05/08 07:44:52 Done.
55 Expect.equals("ab", trace);
56 });
57 await testEvaluation(() async {
58 Expect.isTrue(await confuse(traceA(false)) || await confuse(traceB(true)));
59 Expect.equals("ab", trace);
60 });
61 await testEvaluation(() async {
62 Expect.isTrue(await confuse(traceA(true)) || await confuse(traceB(false)));
63 Expect.equals("a", trace);
64 });
65 await testEvaluation(() async {
66 Expect.isTrue(await confuse(traceA(true)) || await confuse(traceB(true)));
67 Expect.equals("a", trace);
68 });
69
70 }
71
72 test() async {
73 await test1();
74 await test2();
75 }
76
77 main() {
78 asyncStart();
79 test().then((_) => asyncEnd());
80 }
81
82 @NoInline
83 @AssumeDynamic
84 confuse(x) {
floitsch 2015/03/13 08:55:40 move this up.
sigurdm 2015/05/08 07:44:52 Done.
85 return x;
86 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/async_await_js_transform_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698