| 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("compiler_helper.dart"); | 6 #import("compiler_helper.dart"); |
| 7 | 7 |
| 8 const String TEST_ONE = r""" | 8 const String TEST_ONE = r""" |
| 9 void foo(bar) { | 9 void foo(bar) { |
| 10 var a = 1; | 10 var a = 1; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 if (j == 9) b = false; | 50 if (j == 9) b = false; |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 print(a); | 53 print(a); |
| 54 print(b); | 54 print(b); |
| 55 } | 55 } |
| 56 """; | 56 """; |
| 57 | 57 |
| 58 main() { | 58 main() { |
| 59 compileAndMatchFuzzy(TEST_ONE, 'foo', "var x = x === true \\? 2 : 3;"); | 59 compileAndMatchFuzzy(TEST_ONE, 'foo', "var x = x === true \\? 2 : 3;"); |
| 60 compileAndMatchFuzzy(TEST_ONE, 'foo', "print\\(x\\);"); | 60 compileAndMatchFuzzy(TEST_ONE, 'foo', "p(rint)?\\(x\\);"); |
| 61 | 61 |
| 62 compileAndMatchFuzzy(TEST_TWO, 'main', "x \\+= 10"); | 62 compileAndMatchFuzzy(TEST_TWO, 'main', "x \\+= 10"); |
| 63 compileAndMatchFuzzy(TEST_TWO, 'main', "\\+\\+x"); | 63 compileAndMatchFuzzy(TEST_TWO, 'main', "\\+\\+x"); |
| 64 | 64 |
| 65 // Check that we don't have 'd = d' (using regexp back references). | 65 // Check that we don't have 'd = d' (using regexp back references). |
| 66 compileAndDoNotMatchFuzzy(TEST_THREE, 'foo', '(x) = \1'); | 66 compileAndDoNotMatchFuzzy(TEST_THREE, 'foo', '(x) = \1'); |
| 67 compileAndMatchFuzzy(TEST_THREE, 'foo', 'return x'); | 67 compileAndMatchFuzzy(TEST_THREE, 'foo', 'return x'); |
| 68 // Check that a store just after the declaration of the local | 68 // Check that a store just after the declaration of the local |
| 69 // only generates one instruction. | 69 // only generates one instruction. |
| 70 compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42'); | 70 compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42'); |
| 71 | 71 |
| 72 var generated = compile(TEST_FOUR, entry: 'foo'); | 72 var generated = compile(TEST_FOUR, entry: 'foo'); |
| 73 compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;'); | 73 compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;'); |
| 74 } | 74 } |
| OLD | NEW |