OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 | 4 |
5 // Note: This test relies on LF line endings in the source file. | 5 // Note: This test relies on LF line endings in the source file. |
6 | 6 |
7 // Test that JS printer callbacks occur when expected. | 7 // Test that JS printer callbacks occur when expected. |
8 | 8 |
9 library js_ast.printer.callback_test; | 9 library js_ast.printer.callback_test; |
10 | 10 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 TestMode.INPUT: "a.#nameTemplate", | 164 TestMode.INPUT: "a.#nameTemplate", |
165 TestMode.NONE: "a.nameValue", | 165 TestMode.NONE: "a.nameValue", |
166 TestMode.ENTER: "@0@1a.@2nameValue", | 166 TestMode.ENTER: "@0@1a.@2nameValue", |
167 TestMode.DELIMITER: "a.nameValue", | 167 TestMode.DELIMITER: "a.nameValue", |
168 TestMode.EXIT: "a@1.nameValue@2@0", | 168 TestMode.EXIT: "a@1.nameValue@2@0", |
169 }, const {'nameTemplate': 'nameValue'}), | 169 }, const {'nameTemplate': 'nameValue'}), |
170 ]; | 170 ]; |
171 | 171 |
172 class FixedName extends Name { | 172 class FixedName extends Name { |
173 final String name; | 173 final String name; |
| 174 String get key => name; |
174 | 175 |
175 FixedName(this.name); | 176 FixedName(this.name); |
176 | 177 |
177 @override | 178 @override |
178 int compareTo(other) => 0; | 179 int compareTo(other) => 0; |
179 } | 180 } |
180 | 181 |
181 void check(TestCase testCase) { | 182 void check(TestCase testCase) { |
182 Map<TestMode, String> map = testCase.data; | 183 Map<TestMode, String> map = testCase.data; |
183 String code = map[TestMode.INPUT]; | 184 String code = map[TestMode.INPUT]; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 if (offset < text.length) { | 247 if (offset < text.length) { |
247 sb.write(text.substring(offset)); | 248 sb.write(text.substring(offset)); |
248 } | 249 } |
249 return sb.toString(); | 250 return sb.toString(); |
250 } | 251 } |
251 } | 252 } |
252 | 253 |
253 void main() { | 254 void main() { |
254 DATA.forEach(check); | 255 DATA.forEach(check); |
255 } | 256 } |
OLD | NEW |