| Index: test/codegen/end_to_end_test.dart
|
| diff --git a/test/codegen/end_to_end_test.dart b/test/codegen/end_to_end_test.dart
|
| index e066c71c76d1df78368e899b39efbfe4b19fe56d..cc9fc29dbf3666e4b5f157833eb968fe0b4da59a 100644
|
| --- a/test/codegen/end_to_end_test.dart
|
| +++ b/test/codegen/end_to_end_test.dart
|
| @@ -20,7 +20,7 @@ import 'package:path/path.dart' as path;
|
|
|
| import 'testing_resolver_utils.dart' show initAnalyzer;
|
|
|
| -main(args) {
|
| +void main(List<String> args) {
|
| final updateStaticTest = args.length > 0 && args[0] == '--update_static_test';
|
|
|
| test('static_test is up to date', () {
|
| @@ -28,8 +28,7 @@ main(args) {
|
| var testDir = path.dirname(path.dirname(scriptPath));
|
| var commonPath = path.join(testDir, 'common.dart');
|
| var testCode = new File('$commonPath').readAsStringSync();
|
| - var lib = initAnalyzer({'common.dart' : testCode})
|
| - .libraryFor('common.dart');
|
| + var lib = initAnalyzer({'common.dart': testCode}).libraryFor('common.dart');
|
| var generator = new SmokeCodeGenerator();
|
| var recorder = new Recorder(generator, _resolveImportUrl);
|
|
|
| @@ -44,8 +43,15 @@ main(args) {
|
| }
|
|
|
| // Record all getters and setters we use in the tests.
|
| - ['i', 'j', 'j2', 'inc0', 'inc1', 'inc2', 'toString']
|
| - .forEach(generator.addGetter);
|
| + [
|
| + 'i',
|
| + 'j',
|
| + 'j2',
|
| + 'inc0',
|
| + 'inc1',
|
| + 'inc2',
|
| + 'toString'
|
| + ].forEach(generator.addGetter);
|
| ['i', 'j2'].forEach(generator.addSetter);
|
|
|
| // Record static methods used in the tests
|
| @@ -55,8 +61,13 @@ main(args) {
|
| generator.addSymbol('i');
|
|
|
| /// Record all parent-class relations that we explicitly request.
|
| - ['AnnotB', 'A', 'B', 'D', 'H'].forEach(
|
| - (className) => recorder.lookupParent(lib.getType(className)));
|
| + [
|
| + 'AnnotB',
|
| + 'A',
|
| + 'B',
|
| + 'D',
|
| + 'H'
|
| + ].forEach((className) => recorder.lookupParent(lib.getType(className)));
|
|
|
| // Record members for which we implicitly request their declaration in
|
| // has-getter and has-setter tests.
|
| @@ -103,11 +114,12 @@ main(args) {
|
| expect(vars[0].name, 'a1');
|
| expect(vars[1].name, 'a2');
|
|
|
| - runQuery('H', new QueryOptions(includeInherited: true,
|
| + runQuery('H', new QueryOptions(
|
| + includeInherited: true,
|
| withAnnotations: [vars[0], vars[1], lib.getType('Annot')]));
|
|
|
| - runQuery('K', new QueryOptions(includeInherited: true,
|
| - withAnnotations: [lib.getType('AnnotC')]));
|
| + runQuery('K', new QueryOptions(
|
| + includeInherited: true, withAnnotations: [lib.getType('AnnotC')]));
|
|
|
| var code = _createEntrypoint(generator);
|
| var staticTestFile = new File(path.join(testDir, 'static_test.dart'));
|
| @@ -123,14 +135,14 @@ main(args) {
|
| });
|
| }
|
|
|
| -_createEntrypoint(SmokeCodeGenerator generator) {
|
| +String _createEntrypoint(SmokeCodeGenerator generator) {
|
| var sb = new StringBuffer()
|
| - ..writeln('/// ---- AUTOGENERATED: DO NOT EDIT THIS FILE --------------')
|
| - ..writeln('/// To update this test file, call:')
|
| - ..writeln('/// > dart codegen/end_to_end_test.dart --update_static_test')
|
| - ..writeln('/// --------------------------------------------------------')
|
| - ..writeln('\nlibrary smoke.test.static_test;\n')
|
| - ..writeln("import 'package:unittest/unittest.dart';");
|
| + ..writeln('/// ---- AUTOGENERATED: DO NOT EDIT THIS FILE --------------')
|
| + ..writeln('/// To update this test file, call:')
|
| + ..writeln('/// > dart codegen/end_to_end_test.dart --update_static_test')
|
| + ..writeln('/// --------------------------------------------------------')
|
| + ..writeln('\nlibrary smoke.test.static_test;\n')
|
| + ..writeln("import 'package:unittest/unittest.dart';");
|
|
|
| generator.writeImports(sb);
|
| sb.writeln("import 'common.dart' as common show main;\n");
|
| @@ -138,15 +150,16 @@ _createEntrypoint(SmokeCodeGenerator generator) {
|
| sb.write('\nfinal configuration = ');
|
| generator.writeStaticConfiguration(sb, 0);
|
|
|
| - sb..writeln(';\n')
|
| - ..writeln('main() {')
|
| - ..writeln(' setUp(() => useGeneratedCode(configuration));')
|
| - ..writeln(' common.main();')
|
| - ..writeln('}');
|
| + sb
|
| + ..writeln(';\n')
|
| + ..writeln('main() {')
|
| + ..writeln(' setUp(() => useGeneratedCode(configuration));')
|
| + ..writeln(' common.main();')
|
| + ..writeln('}');
|
| return sb.toString();
|
| }
|
|
|
| -_resolveImportUrl(LibraryElement lib) {
|
| +String _resolveImportUrl(LibraryElement lib) {
|
| if (lib.isDartCore) return 'dart:core';
|
| if (lib.displayName == 'smoke.test.common') return 'common.dart';
|
| return 'unknown.dart';
|
|
|