OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// And end-to-end test that generates code and checks that the output matches | 5 /// And end-to-end test that generates code and checks that the output matches |
6 /// the code in `static_test.dart`. Techincally we could run the result in an | 6 /// the code in `static_test.dart`. Techincally we could run the result in an |
7 /// isolate, but instead we decided to split that up in two tests. This test | 7 /// isolate, but instead we decided to split that up in two tests. This test |
8 /// ensures that we generate the code as it was written in static_test, and | 8 /// ensures that we generate the code as it was written in static_test, and |
9 /// separately static_test ensures that the smoke.static library behaves as | 9 /// separately static_test ensures that the smoke.static library behaves as |
10 /// expected. | 10 /// expected. |
(...skipping 28 matching lines...) Expand all Loading... |
39 recorder.lookupMember(lib.getType(className), memberName, | 39 recorder.lookupMember(lib.getType(className), memberName, |
40 recursive: recursive, includeAccessors: false); | 40 recursive: recursive, includeAccessors: false); |
41 } | 41 } |
42 | 42 |
43 runQuery(String className, QueryOptions options) { | 43 runQuery(String className, QueryOptions options) { |
44 recorder.runQuery(lib.getType(className), options, | 44 recorder.runQuery(lib.getType(className), options, |
45 includeAccessors: false); | 45 includeAccessors: false); |
46 } | 46 } |
47 | 47 |
48 // Record all getters and setters we use in the tests. | 48 // Record all getters and setters we use in the tests. |
49 ['i', 'j', 'j2', 'inc0', 'inc1', 'inc2'].forEach(generator.addGetter); | 49 ['i', 'j', 'j2', 'inc0', 'inc1', 'inc2', 'toString'] |
| 50 .forEach(generator.addGetter); |
50 ['i', 'j2'].forEach(generator.addSetter); | 51 ['i', 'j2'].forEach(generator.addSetter); |
51 | 52 |
52 // Record static methods used in the tests | 53 // Record static methods used in the tests |
53 recorder.addStaticMethod(lib.getType('A'), 'staticInc'); | 54 recorder.addStaticMethod(lib.getType('A'), 'staticInc'); |
54 | 55 |
55 // Record symbol convertions. | 56 // Record symbol convertions. |
56 generator.addSymbol('i'); | 57 generator.addSymbol('i'); |
57 | 58 |
58 /// Record all parent-class relations that we explicitly request. | 59 /// Record all parent-class relations that we explicitly request. |
59 ['AnnotB', 'A', 'B', 'D', 'H'].forEach( | 60 ['AnnotB', 'A', 'B', 'D', 'H'].forEach( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 ..writeln(' common.main();') | 146 ..writeln(' common.main();') |
146 ..writeln('}'); | 147 ..writeln('}'); |
147 return sb.toString(); | 148 return sb.toString(); |
148 } | 149 } |
149 | 150 |
150 _resolveImportUrl(LibraryElement lib) { | 151 _resolveImportUrl(LibraryElement lib) { |
151 if (lib.isDartCore) return 'dart:core'; | 152 if (lib.isDartCore) return 'dart:core'; |
152 if (lib.displayName == 'smoke.test.common') return 'common.dart'; | 153 if (lib.displayName == 'smoke.test.common') return 'common.dart'; |
153 return 'unknown.dart'; | 154 return 'unknown.dart'; |
154 } | 155 } |
OLD | NEW |