Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: tests/compiler/dart2js/jsinterop/world_test.dart

Issue 2990223002: Reformat untouched files. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library jsinterop.world_test; 5 library jsinterop.world_test;
6 6
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:compiler/src/elements/elements.dart' show ClassElement; 9 import 'package:compiler/src/elements/elements.dart' show ClassElement;
10 import 'package:compiler/src/elements/names.dart'; 10 import 'package:compiler/src/elements/names.dart';
11 import 'package:compiler/src/universe/selector.dart'; 11 import 'package:compiler/src/universe/selector.dart';
12 import 'package:compiler/src/world.dart'; 12 import 'package:compiler/src/world.dart';
13 import '../type_test_helper.dart'; 13 import '../type_test_helper.dart';
14 14
15 void main() { 15 void main() {
16 asyncTest(() async { 16 asyncTest(() async {
17 await testClasses(); 17 await testClasses();
18 }); 18 });
19 } 19 }
20 20
21 testClasses() async { 21 testClasses() async {
22 test(String mainSource, 22 test(String mainSource,
23 {List<String> directlyInstantiated: const <String>[], 23 {List<String> directlyInstantiated: const <String>[],
24 List<String> abstractlyInstantiated: const <String>[], 24 List<String> abstractlyInstantiated: const <String>[],
25 List<String> indirectlyInstantiated: const <String>[]}) async { 25 List<String> indirectlyInstantiated: const <String>[]}) async {
26 TypeEnvironment env = await TypeEnvironment.create( 26 TypeEnvironment env = await TypeEnvironment.create(r"""
27 r"""
28 @JS() 27 @JS()
29 class A { 28 class A {
30 get foo; 29 get foo;
31 30
32 external A(var foo); 31 external A(var foo);
33 } 32 }
34 33
35 @JS('BClass') 34 @JS('BClass')
36 class B { 35 class B {
37 get foo; 36 get foo;
(...skipping 28 matching lines...) Expand all
66 65
67 F(this.foo); 66 F(this.foo);
68 } 67 }
69 68
70 newA() => new A(0); 69 newA() => new A(0);
71 newB() => new B(1); 70 newB() => new B(1);
72 newC() => new C(foo: 2); 71 newC() => new C(foo: 2);
73 newD() => new D(foo: 3); 72 newD() => new D(foo: 3);
74 newE() => new E(4); 73 newE() => new E(4);
75 newF() => new F(5); 74 newF() => new F(5);
76 """, 75 """, mainSource: """
77 mainSource: """
78 import 'package:js/js.dart'; 76 import 'package:js/js.dart';
79 77
80 $mainSource 78 $mainSource
81 """, 79 """, useMockCompiler: false);
82 useMockCompiler: false);
83 Map<String, ClassElement> classEnvironment = <String, ClassElement>{}; 80 Map<String, ClassElement> classEnvironment = <String, ClassElement>{};
84 81
85 ClassElement registerClass(ClassElement cls) { 82 ClassElement registerClass(ClassElement cls) {
86 classEnvironment[cls.name] = cls; 83 classEnvironment[cls.name] = cls;
87 return cls; 84 return cls;
88 } 85 }
89 86
90 ClosedWorld world = env.closedWorld; 87 ClosedWorld world = env.closedWorld;
91 ClassElement Object_ = registerClass(world.commonElements.objectClass); 88 ClassElement Object_ = registerClass(world.commonElements.objectClass);
92 ClassElement Interceptor = 89 ClassElement Interceptor =
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 192
196 await test('main() => newE();', directlyInstantiated: ['E']); 193 await test('main() => newE();', directlyInstantiated: ['E']);
197 194
198 await test('main() => newF();', directlyInstantiated: ['F']); 195 await test('main() => newF();', directlyInstantiated: ['F']);
199 196
200 await test('main() => [newD(), newE()];', 197 await test('main() => [newD(), newE()];',
201 directlyInstantiated: ['E'], 198 directlyInstantiated: ['E'],
202 abstractlyInstantiated: ['A', 'B', 'C', 'D'], 199 abstractlyInstantiated: ['A', 'B', 'C', 'D'],
203 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']); 200 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']);
204 } 201 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/js_parser_statements_test.dart ('k') | tests/compiler/dart2js/logical_expression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698