OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
ngeoffray
2014/02/21 17:52:26
2012 -> 2014
floitsch
2014/02/21 18:35:26
Done.
| |
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 // Test that parameters keep their names in the output. | |
ngeoffray
2014/02/21 17:52:26
Re-comment.
floitsch
2014/02/21 18:35:26
Done.
| |
5 | |
6 import "package:async_helper/async_helper.dart"; | |
7 import 'compiler_helper.dart'; | |
8 | |
9 const String TEST_ONE = r""" | |
10 foo(bar, gee) { | |
11 bool cond1 = bar(); | |
12 if (cond1 || gee()) gee(); | |
13 if (cond1 || gee()) gee(); | |
14 } | |
15 """; | |
16 | |
17 const String TEST_TWO = r""" | |
18 void foo(list, bar) { | |
19 if (list == null) bar(); | |
20 if (list == null || bar()) bar(); | |
21 if (list == null || bar()) bar(); | |
22 } | |
23 """; | |
24 | |
25 main() { | |
26 // We want something like: | |
27 // var t1 = bar.call$0() === true; | |
28 // if (t1 || gee.call$0() === true) gee.call$0(); | |
29 // if (t1 || gee.call$0() === true) gee.call$0(); | |
30 compileAndDoNotMatchFuzzy(TEST_ONE, 'foo', | |
31 r"""var x = [a-zA-Z0-9$.]+\(\) == true; | |
32 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+; | |
33 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;"""); | |
34 | |
35 | |
36 // We want something like: | |
37 // var t1 = list == null; | |
38 // if (t1) bar.call$0(); | |
39 // if (t1 || bar.call$0() === true) bar.call$0(); | |
40 // if (t1 || bar.call$0() === true) bar.call$0(); | |
41 compileAndMatchFuzzy(TEST_TWO, 'foo', | |
42 r"""var x = x == null; | |
43 if \(x\) [^;]+; | |
44 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+; | |
45 if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;"""); | |
46 } | |
OLD | NEW |