| Index: tests/compiler/dart2js/serialization/test_data.dart
|
| diff --git a/tests/compiler/dart2js/serialization/test_data.dart b/tests/compiler/dart2js/serialization/test_data.dart
|
| index d4b8434890500326b45983beaef5418739c185a4..c3f7befc923993414efdae6cfa2d326829695aca 100644
|
| --- a/tests/compiler/dart2js/serialization/test_data.dart
|
| +++ b/tests/compiler/dart2js/serialization/test_data.dart
|
| @@ -7,15 +7,18 @@ library dart2js.serialization_test_data;
|
| const List<Test> TESTS = const <Test>[
|
| // These tests are very long-running and put here first to compile them on
|
| // their own tests.
|
| - const Test('Disable tree shaking through reflection', const {
|
| - 'main.dart': '''
|
| + const Test(
|
| + 'Disable tree shaking through reflection',
|
| + const {
|
| + 'main.dart': '''
|
| import 'dart:mirrors';
|
|
|
| main() {
|
| reflect(null).invoke(#toString, []).reflectee;
|
| }
|
| ''',
|
| - }, expectedWarningCount: 1),
|
| + },
|
| + expectedWarningCount: 1),
|
|
|
| const Test('Use of dart:indexed_db', const {
|
| 'main.dart': '''
|
| @@ -30,19 +33,14 @@ import 'dart:indexed_db';
|
| }),
|
|
|
| // These tests
|
| - const Test('Empty program', const {
|
| - 'main.dart': 'main() {}'
|
| - }),
|
| + const Test('Empty program', const {'main.dart': 'main() {}'}),
|
|
|
| - const Test('Hello World', const {
|
| - 'main.dart': 'main() => print("Hello World");'
|
| - }),
|
| + const Test(
|
| + 'Hello World', const {'main.dart': 'main() => print("Hello World");'}),
|
|
|
| - const Test('Too many arguments to print', const {
|
| - 'main.dart': 'main() => print("Hello World", 0);'
|
| - },
|
| - expectedWarningCount: 1,
|
| - expectedInfoCount: 1),
|
| + const Test('Too many arguments to print',
|
| + const {'main.dart': 'main() => print("Hello World", 0);'},
|
| + expectedWarningCount: 1, expectedInfoCount: 1),
|
|
|
| const Test('Hello World with string interpolation', const {
|
| 'main.dart': r'''
|
| @@ -52,15 +50,17 @@ main() {
|
| }'''
|
| }),
|
|
|
| - const Test('Too many arguments to print with string interpolation', const {
|
| - 'main.dart': r'''
|
| + const Test(
|
| + 'Too many arguments to print with string interpolation',
|
| + const {
|
| + 'main.dart': r'''
|
| main() {
|
| String text = "Hello World";
|
| print('$text', text);
|
| }'''
|
| - },
|
| - expectedWarningCount: 1,
|
| - expectedInfoCount: 1),
|
| + },
|
| + expectedWarningCount: 1,
|
| + expectedInfoCount: 1),
|
|
|
| const Test('Print main arguments', const {
|
| 'main.dart': r'''
|
| @@ -70,13 +70,13 @@ main(List<String> arguments) {
|
| }),
|
|
|
| const Test('For loop on main arguments', const {
|
| - 'main.dart': r'''
|
| + 'main.dart': r'''
|
| main(List<String> arguments) {
|
| for (int i = 0; i < arguments.length; i++) {
|
| print(arguments[i]);
|
| }
|
| }'''
|
| - }),
|
| + }),
|
|
|
| const Test('For-in loop on main arguments', const {
|
| 'main.dart': r'''
|
| @@ -95,14 +95,16 @@ main() {
|
| }'''
|
| }),
|
|
|
| - const Test('Simple class implements Function without call method', const {
|
| - 'main.dart': r'''
|
| + const Test(
|
| + 'Simple class implements Function without call method',
|
| + const {
|
| + 'main.dart': r'''
|
| class Class implements Function {}
|
| main() {
|
| print(new Class());
|
| }'''
|
| - },
|
| - expectedWarningCount: 1),
|
| + },
|
| + expectedWarningCount: 1),
|
|
|
| const Test('Simple class implements Function with call method', const {
|
| 'main.dart': r'''
|
| @@ -124,43 +126,51 @@ main() {
|
| }'''
|
| }),
|
|
|
| - const Test('Implement Comparable with two many type arguments', const {
|
| - 'main.dart': r'''
|
| + const Test(
|
| + 'Implement Comparable with two many type arguments',
|
| + const {
|
| + 'main.dart': r'''
|
| class Class implements Comparable<Class, Class> {
|
| int compareTo(other) => 0;
|
| }
|
| main() {
|
| print(new Class());
|
| }'''
|
| - },
|
| - expectedWarningCount: 1),
|
| + },
|
| + expectedWarningCount: 1),
|
|
|
| - const Test('Implement Comparable with incompatible parameter types', const {
|
| - 'main.dart': r'''
|
| + const Test(
|
| + 'Implement Comparable with incompatible parameter types',
|
| + const {
|
| + 'main.dart': r'''
|
| class Class implements Comparable<Class> {
|
| int compareTo(String other) => 0;
|
| }
|
| main() {
|
| print(new Class().compareTo(null));
|
| }'''
|
| - },
|
| - expectedWarningCount: 1,
|
| - expectedInfoCount: 1),
|
| + },
|
| + expectedWarningCount: 1,
|
| + expectedInfoCount: 1),
|
|
|
| - const Test('Implement Comparable with incompatible parameter count', const {
|
| - 'main.dart': r'''
|
| + const Test(
|
| + 'Implement Comparable with incompatible parameter count',
|
| + const {
|
| + 'main.dart': r'''
|
| class Class implements Comparable {
|
| bool compareTo(a, b) => true;
|
| }
|
| main() {
|
| print(new Class().compareTo(null, null));
|
| }'''
|
| - },
|
| - expectedWarningCount: 1,
|
| - expectedInfoCount: 1),
|
| + },
|
| + expectedWarningCount: 1,
|
| + expectedInfoCount: 1),
|
|
|
| - const Test('Implement Random and call nextInt directly', const {
|
| - 'main.dart': r'''
|
| + const Test(
|
| + 'Implement Random and call nextInt directly',
|
| + const {
|
| + 'main.dart': r'''
|
| import 'dart:math';
|
|
|
| class MyRandom implements Random {
|
| @@ -173,9 +183,9 @@ class MyRandom implements Random {
|
| main() {
|
| new MyRandom().nextInt(0);
|
| }'''
|
| - },
|
| - expectedWarningCount: 1,
|
| - expectedInfoCount: 0),
|
| + },
|
| + expectedWarningCount: 1,
|
| + expectedInfoCount: 0),
|
|
|
| const Test('Implement Random and do not call nextInt', const {
|
| 'main.dart': r'''
|
| @@ -193,8 +203,10 @@ main() {
|
| }'''
|
| }),
|
|
|
| - const Test('Implement Random and call nextInt through native code', const {
|
| - 'main.dart': r'''
|
| + const Test(
|
| + 'Implement Random and call nextInt through native code',
|
| + const {
|
| + 'main.dart': r'''
|
| import 'dart:math';
|
|
|
| class MyRandom implements Random {
|
| @@ -210,9 +222,9 @@ main() {
|
| // method.
|
| [].shuffle(new MyRandom());
|
| }'''
|
| - },
|
| - expectedWarningCount: 1,
|
| - expectedInfoCount: 0),
|
| + },
|
| + expectedWarningCount: 1,
|
| + expectedInfoCount: 0),
|
|
|
| const Test('Handle break and continue', const {
|
| 'main.dart': '''
|
| @@ -278,9 +290,8 @@ main() => const Duration();
|
| ''',
|
| }),
|
|
|
| - const Test('Call forwarding constructor on named mixin application',
|
| - const {
|
| - 'main.dart': '''
|
| + const Test('Call forwarding constructor on named mixin application', const {
|
| + 'main.dart': '''
|
| import 'dart:collection';
|
| main() => new UnmodifiableListView(null);
|
| ''',
|
| @@ -304,13 +315,15 @@ main() {
|
| ''',
|
| }),
|
|
|
| - const Test('Call forwarding constructor on named mixin application, no args.',
|
| + const Test(
|
| + 'Call forwarding constructor on named mixin application, no args.',
|
| const {
|
| 'main.dart': '''
|
| import 'lib.dart';
|
| main() => new C();
|
| ''',
|
| - }, preserializedSourceFiles: const {
|
| + },
|
| + preserializedSourceFiles: const {
|
| 'lib.dart': '''
|
| class M {}
|
| class S {}
|
| @@ -318,13 +331,15 @@ class C = S with M;
|
| ''',
|
| }),
|
|
|
| - const Test('Call forwarding constructor on named mixin application, one arg.',
|
| + const Test(
|
| + 'Call forwarding constructor on named mixin application, one arg.',
|
| const {
|
| 'main.dart': '''
|
| import 'lib.dart';
|
| main() => new C(0);
|
| ''',
|
| - }, preserializedSourceFiles: const {
|
| + },
|
| + preserializedSourceFiles: const {
|
| 'lib.dart': '''
|
| class M {}
|
| class S {
|
| @@ -334,12 +349,14 @@ class C = S with M;
|
| ''',
|
| }),
|
|
|
| - const Test('Import mirrors, thus checking import paths', const {
|
| - 'main.dart': '''
|
| + const Test(
|
| + 'Import mirrors, thus checking import paths',
|
| + const {
|
| + 'main.dart': '''
|
| import 'dart:mirrors';
|
| main() {}
|
| ''',
|
| - },
|
| + },
|
| expectedWarningCount: 1),
|
|
|
| const Test('Serialized symbol literal', const {
|
| @@ -514,7 +531,7 @@ class D = A with B, C;
|
| ''',
|
| 'b.dart': '''
|
| ''',
|
| -}),
|
| + }),
|
|
|
| const Test('Deferred prefix loadLibrary', const {
|
| 'main.dart': '''
|
| @@ -535,42 +552,50 @@ test() {
|
| ''',
|
| }),
|
|
|
| - const Test('Deferred without prefix', const {
|
| - 'main.dart': '''
|
| + const Test(
|
| + 'Deferred without prefix',
|
| + const {
|
| + 'main.dart': '''
|
| import 'a.dart';
|
|
|
| main() {
|
| test();
|
| }
|
| ''',
|
| - }, preserializedSourceFiles: const {
|
| - 'a.dart': '''
|
| + },
|
| + preserializedSourceFiles: const {
|
| + 'a.dart': '''
|
| import 'b.dart' deferred;
|
| test() {}
|
| ''',
|
| - 'b.dart': '''
|
| + 'b.dart': '''
|
| ''',
|
| - }, expectedErrorCount: 1),
|
| + },
|
| + expectedErrorCount: 1),
|
|
|
| - const Test('Deferred with duplicate prefix', const {
|
| - 'main.dart': '''
|
| + const Test(
|
| + 'Deferred with duplicate prefix',
|
| + const {
|
| + 'main.dart': '''
|
| import 'a.dart';
|
|
|
| main() {
|
| test();
|
| }
|
| ''',
|
| - }, preserializedSourceFiles: const {
|
| - 'a.dart': '''
|
| + },
|
| + preserializedSourceFiles: const {
|
| + 'a.dart': '''
|
| import 'b.dart' deferred as pre;
|
| import 'c.dart' deferred as pre;
|
| test() {}
|
| ''',
|
| - 'b.dart': '''
|
| + 'b.dart': '''
|
| ''',
|
| - 'c.dart': '''
|
| + 'c.dart': '''
|
| ''',
|
| - }, expectedErrorCount: 1),
|
| + },
|
| + expectedErrorCount: 1),
|
|
|
| const Test('Closure in operator function', const {
|
| 'main.dart': '''
|
| @@ -590,23 +615,27 @@ test() => new C() == null;
|
| ''',
|
| }),
|
|
|
| - const Test('Checked setter', const {
|
| - 'main.dart': '''
|
| + const Test(
|
| + 'Checked setter',
|
| + const {
|
| + 'main.dart': '''
|
| import 'a.dart';
|
|
|
| main() {
|
| test();
|
| }
|
| ''',
|
| - }, preserializedSourceFiles: const {
|
| - 'a.dart': '''
|
| + },
|
| + preserializedSourceFiles: const {
|
| + 'a.dart': '''
|
| class C {
|
| set foo(int i) {}
|
| }
|
|
|
| test() => new C().foo = 0;
|
| ''',
|
| - }, checkedMode: true),
|
| + },
|
| + checkedMode: true),
|
|
|
| const Test('Deferred access', const {
|
| 'main.dart': '''
|
| @@ -659,12 +688,12 @@ import 'dart:indexed_db';
|
|
|
| const Test('Deferred static access', const {},
|
| preserializedSourceFiles: const {
|
| - 'main.dart': '''
|
| + 'main.dart': '''
|
| import 'b.dart' deferred as prefix;
|
|
|
| main() => prefix.loadLibrary().then((_) => prefix.test2());
|
| ''',
|
| - 'b.dart': '''
|
| + 'b.dart': '''
|
| test2() => x;
|
| var x = const ConstClass(const ConstClass(1));
|
| class ConstClass {
|
| @@ -672,7 +701,7 @@ class ConstClass {
|
| const ConstClass(this.x);
|
| }
|
| ''',
|
| - }),
|
| + }),
|
|
|
| const Test('Multi variable declaration', const {
|
| 'main.dart': '''
|
| @@ -686,9 +715,8 @@ var x, y = 2;
|
| ''',
|
| }),
|
|
|
| - const Test('Double values', const {},
|
| - preserializedSourceFiles: const {
|
| - 'main.dart': '''
|
| + const Test('Double values', const {}, preserializedSourceFiles: const {
|
| + 'main.dart': '''
|
| const a = 1e+400;
|
| main() => a;
|
| ''',
|
| @@ -696,27 +724,28 @@ main() => a;
|
|
|
| const Test('Erroneous constructor', const {},
|
| preserializedSourceFiles: const {
|
| - 'main.dart': '''
|
| + 'main.dart': '''
|
| main() => new Null();
|
| -'''}),
|
| +'''
|
| + }),
|
|
|
| - const Test('Metadata on imports', const {},
|
| - preserializedSourceFiles: const {
|
| - 'main.dart': '''
|
| + const Test('Metadata on imports', const {}, preserializedSourceFiles: const {
|
| + 'main.dart': '''
|
| @deprecated
|
| import 'main.dart';
|
|
|
| main() {}
|
| -'''}),
|
| +'''
|
| + }),
|
|
|
| - const Test('Metadata on exports', const {},
|
| - preserializedSourceFiles: const {
|
| - 'main.dart': '''
|
| + const Test('Metadata on exports', const {}, preserializedSourceFiles: const {
|
| + 'main.dart': '''
|
| @deprecated
|
| export 'main.dart';
|
|
|
| main() {}
|
| -'''}),
|
| +'''
|
| + }),
|
|
|
| const Test('Metadata on part tags', const {},
|
| preserializedSourceFiles: const {
|
| @@ -727,11 +756,13 @@ library main;
|
| part 'a.dart';
|
|
|
| main() {}
|
| -'''},
|
| +'''
|
| + },
|
| unserializedSourceFiles: const {
|
| 'a.dart': '''
|
| part of main;
|
| -'''}),
|
| +'''
|
| + }),
|
|
|
| const Test('Metadata on part-of tags', const {},
|
| preserializedSourceFiles: const {
|
| @@ -741,27 +772,29 @@ library main;
|
| part 'a.dart';
|
|
|
| main() {}
|
| -'''},
|
| +'''
|
| + },
|
| unserializedSourceFiles: const {
|
| 'a.dart': '''
|
| @deprecated
|
| part of main;
|
| -'''}),
|
| +'''
|
| + }),
|
|
|
| - const Test('Ambiguous elements', const {},
|
| - preserializedSourceFiles: const {
|
| - 'main.dart': '''
|
| + const Test('Ambiguous elements', const {}, preserializedSourceFiles: const {
|
| + 'main.dart': '''
|
| import 'a.dart';
|
| import 'b.dart';
|
|
|
| main() => new foo();
|
| ''',
|
| - 'a.dart': '''
|
| + 'a.dart': '''
|
| var foo;
|
| ''',
|
| - 'b.dart': '''
|
| + 'b.dart': '''
|
| var foo;
|
| -''',}),
|
| +''',
|
| + }),
|
|
|
| const Test('html and mirrors', const {},
|
| preserializedSourceFiles: const {
|
| @@ -769,7 +802,8 @@ var foo;
|
| import 'dart:html';
|
| import 'dart:mirrors';
|
| main() {}
|
| -'''},
|
| +'''
|
| + },
|
| expectedWarningCount: 1),
|
| ];
|
|
|
| @@ -784,9 +818,7 @@ class Test {
|
| final int expectedInfoCount;
|
| final bool checkedMode;
|
|
|
| - const Test(
|
| - this.name,
|
| - this.sourceFiles,
|
| + const Test(this.name, this.sourceFiles,
|
| {this.preserializedSourceFiles,
|
| this.unserializedSourceFiles,
|
| this.expectedErrorCount: 0,
|
|
|