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