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

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

Issue 2990773002: Migrate language/arithmetic2_test ... language/async_await_syntax_test. (Closed)
Patch Set: Update migrated tests and statuses to Dart 2.0. Created 3 years, 4 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) 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 @NoInline()
8 @AssumeDynamic()
9 confuse(x) {
10 return x;
11 }
12
13 test1() async {
14 Expect.isFalse(await confuse(false) && await confuse(false));
15 Expect.isFalse(await confuse(false) && await confuse(true));
16 Expect.isFalse(await confuse(true) && await confuse(false));
17 Expect.isTrue(await confuse(true) && await confuse(true));
18
19 Expect.isFalse(await confuse(false) || await confuse(false));
20 Expect.isTrue(await confuse(false) || await confuse(true));
21 Expect.isTrue(await confuse(true) || await confuse(false));
22 Expect.isTrue(await confuse(true) || await confuse(true));
23 }
24
25 String trace;
26
27 traceA(x) {
28 trace += "a";
29 return x;
30 }
31
32 traceB(x) {
33 trace += "b";
34 return x;
35 }
36
37 testEvaluation(void fn()) async {
38 trace = "";
39 await fn();
40 }
41
42 test2() async {
43 await testEvaluation(() async {
44 Expect
45 .isFalse(await confuse(traceA(false)) && await confuse(traceB(false)));
46 Expect.equals("a", trace);
47 });
48 await testEvaluation(() async {
49 Expect.isFalse(await confuse(traceA(false)) && await confuse(traceB(true)));
50 Expect.equals("a", trace);
51 });
52 await testEvaluation(() async {
53 Expect.isFalse(await confuse(traceA(true)) && await confuse(traceB(false)));
54 Expect.equals("ab", trace);
55 });
56 await testEvaluation(() async {
57 Expect.isTrue(await confuse(traceA(true)) && await confuse(traceB(true)));
58 Expect.equals("ab", trace);
59 });
60
61 await testEvaluation(() async {
62 Expect
63 .isFalse(await confuse(traceA(false)) || await confuse(traceB(false)));
64 Expect.equals("ab", trace);
65 });
66 await testEvaluation(() async {
67 Expect.isTrue(await confuse(traceA(false)) || await confuse(traceB(true)));
68 Expect.equals("ab", trace);
69 });
70 await testEvaluation(() async {
71 Expect.isTrue(await confuse(traceA(true)) || await confuse(traceB(false)));
72 Expect.equals("a", trace);
73 });
74 await testEvaluation(() async {
75 Expect.isTrue(await confuse(traceA(true)) || await confuse(traceB(true)));
76 Expect.equals("a", trace);
77 });
78 }
79
80 test() async {
81 await test1();
82 await test2();
83 }
84
85 main() {
86 asyncStart();
87 test().then((_) => asyncEnd());
88 }
OLDNEW
« no previous file with comments | « tests/language_strong/assignable_expression_test.dart ('k') | tests/language_strong/async_await_catch_regression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698