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