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

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

Issue 2995643002: Support jsinterop/world_test from .dill (Closed)
Patch Set: Updated cf. comments 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/common_elements.dart'; 9 import 'package:compiler/src/common_elements.dart';
10 import 'package:compiler/src/elements/entities.dart' show ClassEntity; 10 import 'package:compiler/src/elements/entities.dart' show ClassEntity;
11 import 'package:compiler/src/elements/names.dart'; 11 import 'package:compiler/src/elements/names.dart';
12 import 'package:compiler/src/universe/selector.dart'; 12 import 'package:compiler/src/universe/selector.dart';
13 import 'package:compiler/src/world.dart'; 13 import 'package:compiler/src/world.dart';
14 import '../type_test_helper.dart'; 14 import '../type_test_helper.dart';
15 15
16 void main() { 16 void main() {
17 asyncTest(() async { 17 asyncTest(() async {
18 await testClasses(); 18 await testClasses(CompileMode.memory);
19 await testClasses(CompileMode.dill);
19 }); 20 });
20 } 21 }
21 22
22 testClasses() async { 23 testClasses(CompileMode compileMode) async {
23 test(String mainSource, 24 test(String mainSource,
24 {List<String> directlyInstantiated: const <String>[], 25 {List<String> directlyInstantiated: const <String>[],
25 List<String> abstractlyInstantiated: const <String>[], 26 List<String> abstractlyInstantiated: const <String>[],
26 List<String> indirectlyInstantiated: const <String>[]}) async { 27 List<String> indirectlyInstantiated: const <String>[]}) async {
27 TypeEnvironment env = await TypeEnvironment.create(r""" 28 TypeEnvironment env = await TypeEnvironment.create(r"""
28 @JS() 29 @JS()
29 class A { 30 class A {
30 get foo; 31 get foo;
31 32
32 external A(var foo); 33 external A(var foo);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 newA() => new A(0); 71 newA() => new A(0);
71 newB() => new B(1); 72 newB() => new B(1);
72 newC() => new C(foo: 2); 73 newC() => new C(foo: 2);
73 newD() => new D(foo: 3); 74 newD() => new D(foo: 3);
74 newE() => new E(4); 75 newE() => new E(4);
75 newF() => new F(5); 76 newF() => new F(5);
76 """, mainSource: """ 77 """, mainSource: """
77 import 'package:js/js.dart'; 78 import 'package:js/js.dart';
78 79
79 $mainSource 80 $mainSource
80 """, compileMode: CompileMode.memory); 81 """, compileMode: compileMode);
81 Map<String, ClassEntity> classEnvironment = <String, ClassEntity>{}; 82 Map<String, ClassEntity> classEnvironment = <String, ClassEntity>{};
82 83
83 ClassEntity registerClass(ClassEntity cls) { 84 ClassEntity registerClass(ClassEntity cls) {
84 classEnvironment[cls.name] = cls; 85 classEnvironment[cls.name] = cls;
85 return cls; 86 return cls;
86 } 87 }
87 88
88 ClosedWorld world = env.closedWorld; 89 ClosedWorld world = env.closedWorld;
89 ElementEnvironment elementEnvironment = world.elementEnvironment; 90 ElementEnvironment elementEnvironment = world.elementEnvironment;
90 ClassEntity Object_ = registerClass(world.commonElements.objectClass); 91 ClassEntity Object_ = registerClass(world.commonElements.objectClass);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 196
196 await test('main() => newE();', directlyInstantiated: ['E']); 197 await test('main() => newE();', directlyInstantiated: ['E']);
197 198
198 await test('main() => newF();', directlyInstantiated: ['F']); 199 await test('main() => newF();', directlyInstantiated: ['F']);
199 200
200 await test('main() => [newD(), newE()];', 201 await test('main() => [newD(), newE()];',
201 directlyInstantiated: ['E'], 202 directlyInstantiated: ['E'],
202 abstractlyInstantiated: ['A', 'B', 'C', 'D'], 203 abstractlyInstantiated: ['A', 'B', 'C', 'D'],
203 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']); 204 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']);
204 } 205 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_impact.dart ('k') | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698