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

Side by Side Diff: tests/compiler/dart2js/logical_expression_test.dart

Issue 326913002: Make dart2js unittests async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 6 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/literal_map_test.dart ('k') | tests/compiler/dart2js/loop_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Test that logical or-expressions don't introduce unnecessary nots. 5 // Test that logical or-expressions don't introduce unnecessary nots.
6 6
7 import "package:async_helper/async_helper.dart"; 7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart';
8 import 'compiler_helper.dart'; 9 import 'compiler_helper.dart';
9 10
10 const String TEST_ONE = r""" 11 const String TEST_ONE = r"""
11 foo(bar, gee) { 12 foo(bar, gee) {
12 bool cond1 = bar(); 13 bool cond1 = bar();
13 if (cond1 || gee()) gee(); 14 if (cond1 || gee()) gee();
14 if (cond1 || gee()) gee(); 15 if (cond1 || gee()) gee();
15 } 16 }
16 """; 17 """;
17 18
18 const String TEST_TWO = r""" 19 const String TEST_TWO = r"""
19 void foo(list, bar) { 20 void foo(list, bar) {
20 if (list == null) bar(); 21 if (list == null) bar();
21 if (list == null || bar()) bar(); 22 if (list == null || bar()) bar();
22 if (list == null || bar()) bar(); 23 if (list == null || bar()) bar();
23 } 24 }
24 """; 25 """;
25 26
26 main() { 27 main() {
27 // We want something like: 28 asyncTest(() => Future.wait([
28 // var t1 = bar.call$0() === true; 29 // We want something like:
29 // if (t1 || gee.call$0() === true) gee.call$0(); 30 // var t1 = bar.call$0() === true;
30 // if (t1 || gee.call$0() === true) gee.call$0(); 31 // if (t1 || gee.call$0() === true) gee.call$0();
31 compileAndDoNotMatchFuzzy(TEST_ONE, 'foo', 32 // if (t1 || gee.call$0() === true) gee.call$0();
32 r"""var x = [a-zA-Z0-9$.]+\(\) == true; 33 compileAndDoNotMatchFuzzy(TEST_ONE, 'foo',
33 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+; 34 r"""var x = [a-zA-Z0-9$.]+\(\) == true;
34 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;"""); 35 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;
36 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;"""),
35 37
36 38
37 // We want something like: 39 // We want something like:
38 // var t1 = list == null; 40 // var t1 = list == null;
39 // if (t1) bar.call$0(); 41 // if (t1) bar.call$0();
40 // if (t1 || bar.call$0() === true) bar.call$0(); 42 // if (t1 || bar.call$0() === true) bar.call$0();
41 // if (t1 || bar.call$0() === true) bar.call$0(); 43 // if (t1 || bar.call$0() === true) bar.call$0();
42 compileAndMatchFuzzy(TEST_TWO, 'foo', 44 compileAndMatchFuzzy(TEST_TWO, 'foo',
43 r"""var x = x == null; 45 r"""var x = x == null;
44 if \(x\) [^;]+; 46 if \(x\) [^;]+;
45 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+; 47 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;
46 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;"""); 48 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;"""),
49 ]));
47 } 50 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/literal_map_test.dart ('k') | tests/compiler/dart2js/loop_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698