| 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'; |
| 7 import 'package:async_helper/async_helper.dart'; |
| 6 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
| 7 | 9 |
| 8 const String TEST_ONE = r""" | 10 const String TEST_ONE = r""" |
| 9 void foo(bar) { | 11 void foo(bar) { |
| 10 var a = 1; | 12 var a = 1; |
| 11 if (bar) { | 13 if (bar) { |
| 12 a = 2; | 14 a = 2; |
| 13 } else { | 15 } else { |
| 14 a = 3; | 16 a = 3; |
| 15 } | 17 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 var hash = 0; | 63 var hash = 0; |
| 62 for (var i = 0; i == 0; i = i + 1) { | 64 for (var i = 0; i == 0; i = i + 1) { |
| 63 hash = hash + 10; | 65 hash = hash + 10; |
| 64 hash = hash + 42; | 66 hash = hash + 42; |
| 65 } | 67 } |
| 66 print(t); | 68 print(t); |
| 67 } | 69 } |
| 68 """; | 70 """; |
| 69 | 71 |
| 70 main() { | 72 main() { |
| 71 compileAndMatchFuzzy(TEST_ONE, 'foo', "var x = x === true \\? 2 : 3;"); | 73 asyncTest(() => Future.wait([ |
| 72 compileAndMatchFuzzy(TEST_ONE, 'foo', "print\\(x\\);"); | 74 compileAndMatchFuzzy(TEST_ONE, 'foo', "var x = x === true \\? 2 : 3;"), |
| 75 compileAndMatchFuzzy(TEST_ONE, 'foo', "print\\(x\\);"), |
| 73 | 76 |
| 74 compileAndMatchFuzzy(TEST_TWO, 'main', "x \\+= 10"); | 77 compileAndMatchFuzzy(TEST_TWO, 'main', "x \\+= 10"), |
| 75 compileAndMatchFuzzy(TEST_TWO, 'main', "\\+\\+x"); | 78 compileAndMatchFuzzy(TEST_TWO, 'main', "\\+\\+x"), |
| 76 | 79 |
| 77 // 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). |
| 78 compileAndDoNotMatchFuzzy(TEST_THREE, 'foo', '(x) = \1'); | 81 compileAndDoNotMatchFuzzy(TEST_THREE, 'foo', '(x) = \1'), |
| 79 compileAndMatchFuzzy(TEST_THREE, 'foo', 'return x'); | 82 compileAndMatchFuzzy(TEST_THREE, 'foo', 'return x'), |
| 80 // Check that a store just after the declaration of the local | 83 // Check that a store just after the declaration of the local |
| 81 // only generates one instruction. | 84 // only generates one instruction. |
| 82 compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42'); | 85 compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42'), |
| 83 | 86 |
| 84 compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;'); | 87 compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;'), |
| 85 | 88 |
| 86 compileAndDoNotMatch(TEST_FIVE, 'main', new RegExp('hash0')); | 89 compileAndDoNotMatch(TEST_FIVE, 'main', new RegExp('hash0')), |
| 90 ])); |
| 87 } | 91 } |
| OLD | NEW |