| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 final String TEST_ONE = @""" | 8 const String TEST_ONE = @""" |
| 9 class A { foo() => 499; } | 9 class A { foo() => 499; } |
| 10 class B { bar() => 499; } | 10 class B { bar() => 499; } |
| 11 class C { gee() => 499; } | 11 class C { gee() => 499; } |
| 12 | 12 |
| 13 void main() { | 13 void main() { |
| 14 new C().gee(); | 14 new C().gee(); |
| 15 new B().bar(); | 15 new B().bar(); |
| 16 new A().foo(); | 16 new A().foo(); |
| 17 } | 17 } |
| 18 """; | 18 """; |
| 19 | 19 |
| 20 final String TEST_TWO = @""" | 20 const String TEST_TWO = @""" |
| 21 class A extends B { foo() => 499; } | 21 class A extends B { foo() => 499; } |
| 22 class B extends C { bar() => 499; } | 22 class B extends C { bar() => 499; } |
| 23 class C { gee() => 499; } | 23 class C { gee() => 499; } |
| 24 | 24 |
| 25 void main() { | 25 void main() { |
| 26 new C().gee(); | 26 new C().gee(); |
| 27 new B().bar(); | 27 new B().bar(); |
| 28 new A().foo(); | 28 new A().foo(); |
| 29 } | 29 } |
| 30 """; | 30 """; |
| 31 | 31 |
| 32 main() { | 32 main() { |
| 33 // Make sure that class A, B and C are emitted in that order. For simplicity | 33 // Make sure that class A, B and C are emitted in that order. For simplicity |
| 34 // we just verify that their members are in the correct order. | 34 // we just verify that their members are in the correct order. |
| 35 RegExp regexp = const RegExp(@"foo\$0?:(.|\n)*bar\$0:(.|\n)*gee\$0:"); | 35 RegExp regexp = const RegExp(@"foo\$0?:(.|\n)*bar\$0:(.|\n)*gee\$0:"); |
| 36 | 36 |
| 37 String generated = compileAll(TEST_ONE); | 37 String generated = compileAll(TEST_ONE); |
| 38 print(generated); | 38 print(generated); |
| 39 Expect.isTrue(regexp.hasMatch(generated)); | 39 Expect.isTrue(regexp.hasMatch(generated)); |
| 40 | 40 |
| 41 generated = compileAll(TEST_TWO); | 41 generated = compileAll(TEST_TWO); |
| 42 Expect.isTrue(regexp.hasMatch(generated)); | 42 Expect.isTrue(regexp.hasMatch(generated)); |
| 43 } | 43 } |
| OLD | NEW |