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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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'].forEach(generator.addGetter); |
50 ['i', 'j2'].forEach(generator.addSetter); | 50 ['i', 'j2'].forEach(generator.addSetter); |
51 | 51 |
| 52 // Record static methods used in the tests |
| 53 recorder.addStaticMethod(lib.getType('A'), 'staticInc'); |
| 54 |
52 // Record symbol convertions. | 55 // Record symbol convertions. |
53 generator.addSymbol('i'); | 56 generator.addSymbol('i'); |
54 | 57 |
55 /// Record all parent-class relations that we explicitly request. | 58 /// Record all parent-class relations that we explicitly request. |
56 ['AnnotB', 'A', 'B', 'D', 'H'].forEach( | 59 ['AnnotB', 'A', 'B', 'D', 'H'].forEach( |
57 (className) => recorder.lookupParent(lib.getType(className))); | 60 (className) => recorder.lookupParent(lib.getType(className))); |
58 | 61 |
59 // Record members for which we implicitly request their declaration in | 62 // Record members for which we implicitly request their declaration in |
60 // has-getter and has-setter tests. | 63 // has-getter and has-setter tests. |
61 lookupMember('A', 'i', true); | 64 lookupMember('A', 'i', true); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 ..writeln(' common.main();') | 142 ..writeln(' common.main();') |
140 ..writeln('}'); | 143 ..writeln('}'); |
141 return sb.toString(); | 144 return sb.toString(); |
142 } | 145 } |
143 | 146 |
144 _resolveImportUrl(LibraryElement lib) { | 147 _resolveImportUrl(LibraryElement lib) { |
145 if (lib.isDartCore) return 'dart:core'; | 148 if (lib.isDartCore) return 'dart:core'; |
146 if (lib.displayName == 'smoke.test.common') return 'common.dart'; | 149 if (lib.displayName == 'smoke.test.common') return 'common.dart'; |
147 return 'unknown.dart'; | 150 return 'unknown.dart'; |
148 } | 151 } |
OLD | NEW |