| 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 "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 7 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
| 8 import 'parser_helper.dart'; | 9 import 'parser_helper.dart'; |
| 9 | 10 |
| 10 const String TEST_ONE = r""" | 11 const String TEST_ONE = r""" |
| 11 class A { } | 12 class A { } |
| 12 class B { } | 13 class B { } |
| 13 | 14 |
| 14 main() { | 15 main() { |
| 15 new A(); | 16 new A(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 var a; | 58 var a; |
| 58 A(a) : this.a = a {} | 59 A(a) : this.a = a {} |
| 59 } | 60 } |
| 60 | 61 |
| 61 main() { | 62 main() { |
| 62 new A(3); | 63 new A(3); |
| 63 } | 64 } |
| 64 """; | 65 """; |
| 65 | 66 |
| 66 twoClasses() { | 67 twoClasses() { |
| 67 String generated = compileAll(TEST_ONE); | 68 return compileAll(TEST_ONE).then((generated) { |
| 68 Expect.isTrue(generated.contains('A: {"": "Object;"')); | 69 Expect.isTrue(generated.contains('A: {"": "Object;"')); |
| 69 Expect.isTrue(generated.contains('B: {"": "Object;"')); | 70 Expect.isTrue(generated.contains('B: {"": "Object;"')); |
| 71 }); |
| 70 } | 72 } |
| 71 | 73 |
| 72 subClass() { | 74 subClass() { |
| 73 checkOutput(String generated) { | 75 checkOutput(String generated) { |
| 74 Expect.isTrue(generated.contains('A: {"": "Object;"')); | 76 Expect.isTrue(generated.contains('A: {"": "Object;"')); |
| 75 Expect.isTrue(generated.contains('B: {"": "A;"')); | 77 Expect.isTrue(generated.contains('B: {"": "A;"')); |
| 76 } | 78 } |
| 77 | 79 |
| 78 checkOutput(compileAll(TEST_TWO)); | 80 compileAll(TEST_TWO).then(checkOutput); |
| 79 checkOutput(compileAll(TEST_THREE)); | 81 compileAll(TEST_THREE).then(checkOutput); |
| 80 } | 82 } |
| 81 | 83 |
| 82 fieldTest() { | 84 fieldTest() { |
| 83 String generated = compileAll(TEST_FOUR); | 85 return compileAll(TEST_FOUR).then((generated) { |
| 84 Expect.isTrue(generated.contains(r"""B: {"": "A;y,z,x"}""")); | 86 Expect.isTrue(generated.contains(r"""B: {"": "A;y,z,x"}""")); |
| 87 }); |
| 85 } | 88 } |
| 86 | 89 |
| 87 constructor1() { | 90 constructor1() { |
| 88 String generated = compileAll(TEST_FIVE); | 91 return compileAll(TEST_FIVE).then((generated) { |
| 89 Expect.isTrue(generated.contains(new RegExp(r"new [$a-z]+\.A\(a\);"))); | 92 Expect.isTrue(generated.contains(new RegExp(r"new [$a-z]+\.A\(a\);"))); |
| 93 }); |
| 90 } | 94 } |
| 91 | 95 |
| 92 main() { | 96 main() { |
| 93 twoClasses(); | 97 twoClasses(); |
| 94 subClass(); | 98 subClass(); |
| 95 fieldTest(); | 99 fieldTest(); |
| 96 constructor1(); | 100 constructor1(); |
| 97 } | 101 } |
| OLD | NEW |