OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Test that parameters keep their names in the output. | 4 // Test that parameters keep their names in the output. |
5 | 5 |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
9 | 9 |
10 const String TEST_ONE = r""" | 10 const String TEST_ONE = r""" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 for (var i = 0; i == 0; i = i + 1) { | 64 for (var i = 0; i == 0; i = i + 1) { |
65 hash = hash + 10; | 65 hash = hash + 10; |
66 hash = hash + 42; | 66 hash = hash + 42; |
67 } | 67 } |
68 print(t); | 68 print(t); |
69 } | 69 } |
70 """; | 70 """; |
71 | 71 |
72 main() { | 72 main() { |
73 asyncTest(() => Future.wait([ | 73 asyncTest(() => Future.wait([ |
74 compileAndMatchFuzzy(TEST_ONE, 'foo', "var x = x === true \\? 2 : 3;"), | 74 compileAndMatchFuzzy(TEST_ONE, 'foo', "var x = x === true \\? 2 : 3;"), |
75 compileAndMatchFuzzy(TEST_ONE, 'foo', "print\\(x\\);"), | 75 compileAndMatchFuzzy(TEST_ONE, 'foo', "print\\(x\\);"), |
76 | 76 |
77 compileAndMatchFuzzy(TEST_TWO, 'main', "x \\+= 10"), | 77 compileAndMatchFuzzy(TEST_TWO, 'main', "x \\+= 10"), |
78 compileAndMatchFuzzy(TEST_TWO, 'main', "\\+\\+x"), | 78 compileAndMatchFuzzy(TEST_TWO, 'main', "\\+\\+x"), |
79 | 79 |
80 // Check that we don't have 'd = d' (using regexp back references). | 80 // Check that we don't have 'd = d' (using regexp back references). |
81 compileAndDoNotMatchFuzzy(TEST_THREE, 'foo', '(x) = \1'), | 81 compileAndDoNotMatchFuzzy(TEST_THREE, 'foo', '(x) = \1'), |
82 compileAndMatchFuzzy(TEST_THREE, 'foo', 'return x'), | 82 compileAndMatchFuzzy(TEST_THREE, 'foo', 'return x'), |
83 // Check that a store just after the declaration of the local | 83 // Check that a store just after the declaration of the local |
84 // only generates one instruction. | 84 // only generates one instruction. |
85 compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42'), | 85 compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42'), |
86 | 86 |
87 compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;'), | 87 compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;'), |
88 | 88 |
89 compileAndDoNotMatch(TEST_FIVE, 'main', new RegExp('hash0')), | 89 compileAndDoNotMatch(TEST_FIVE, 'main', new RegExp('hash0')), |
90 ])); | 90 ])); |
91 } | 91 } |
OLD | NEW |