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

Side by Side Diff: tests/compiler/dart2js/source_map_name_test.dart

Issue 2846433003: Run closed_world2_test using the normal compiler pipeline. (Closed)
Patch Set: Updated cf. comments Created 3 years, 7 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 source_map_name_test; 5 library source_map_name_test;
6 6
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 import 'package:compiler/src/compiler.dart'; 9 import 'package:compiler/src/compiler.dart';
10 import 'package:compiler/src/elements/elements.dart'; 10 import 'package:compiler/src/elements/elements.dart';
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 String name = computeElementNameForSourceMaps(element); 75 String name = computeElementNameForSourceMaps(element);
76 Expect.equals(expectedName, name, 76 Expect.equals(expectedName, name,
77 "Unexpected name '$name' for $element, expected '$expectedName'."); 77 "Unexpected name '$name' for $element, expected '$expectedName'.");
78 } 78 }
79 79
80 main() { 80 main() {
81 asyncTest(() async { 81 asyncTest(() async {
82 CompilationResult result = 82 CompilationResult result =
83 await runCompiler(memorySourceFiles: {'main.dart': SOURCE}); 83 await runCompiler(memorySourceFiles: {'main.dart': SOURCE});
84 Compiler compiler = result.compiler; 84 Compiler compiler = result.compiler;
85 LibraryElement mainApp = compiler.mainApp;
85 86
86 Element lookup(String name) { 87 Element lookup(String name) {
87 Element element; 88 Element element;
88 int dotPosition = name.indexOf('.'); 89 int dotPosition = name.indexOf('.');
89 if (dotPosition != -1) { 90 if (dotPosition != -1) {
90 String clsName = name.substring(0, dotPosition); 91 String clsName = name.substring(0, dotPosition);
91 ClassElement cls = compiler.mainApp.find(clsName); 92 ClassElement cls = mainApp.find(clsName);
92 Expect.isNotNull(cls, "Class '$clsName' not found."); 93 Expect.isNotNull(cls, "Class '$clsName' not found.");
93 element = cls.localLookup(name.substring(dotPosition + 1)); 94 element = cls.localLookup(name.substring(dotPosition + 1));
94 } else { 95 } else {
95 element = compiler.mainApp.find(name); 96 element = mainApp.find(name);
96 } 97 }
97 Expect.isNotNull(element, "Element '$name' not found."); 98 Expect.isNotNull(element, "Element '$name' not found.");
98 return element; 99 return element;
99 } 100 }
100 101
101 void checkName(String expectedName, 102 void checkName(String expectedName,
102 [List<String> expectedClosureNames, String lookupName]) { 103 [List<String> expectedClosureNames, String lookupName]) {
103 if (lookupName == null) { 104 if (lookupName == null) {
104 lookupName = expectedName; 105 lookupName = expectedName;
105 } 106 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 checkName('Class.instanceAnonymous', 147 checkName('Class.instanceAnonymous',
147 ['Class.instanceAnonymous.<anonymous function>']); 148 ['Class.instanceAnonymous.<anonymous function>']);
148 checkName('Class.instanceLocal', ['Class.instanceLocal.localMethod']); 149 checkName('Class.instanceLocal', ['Class.instanceLocal.localMethod']);
149 checkName('Class.instanceNestedLocal', [ 150 checkName('Class.instanceNestedLocal', [
150 'Class.instanceNestedLocal.localMethod', 151 'Class.instanceNestedLocal.localMethod',
151 'Class.instanceNestedLocal.localMethod.<anonymous function>', 152 'Class.instanceNestedLocal.localMethod.<anonymous function>',
152 'Class.instanceNestedLocal.localMethod.nestedLocalMethod' 153 'Class.instanceNestedLocal.localMethod.nestedLocalMethod'
153 ]); 154 ]);
154 }); 155 });
155 } 156 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/resolver_test.dart ('k') | tests/compiler/dart2js/type_checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698