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

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

Issue 10836355: Make sure that libraries loaded from dart:core gets dart:core implicitly loaded. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix mock compiler Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Test constant folding. 4 // Test constant folding.
5 5
6 #library("compiler_helper"); 6 #library("compiler_helper");
7 7
8 #import("dart:uri"); 8 #import("dart:uri");
9 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg"); 9 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg");
10 #import("../../../lib/compiler/implementation/js_backend/js_backend.dart", prefi x: "js"); 10 #import("../../../lib/compiler/implementation/js_backend/js_backend.dart", prefi x: "js");
(...skipping 18 matching lines...) Expand all
29 MockCompiler compilerFor(String code, Uri uri) { 29 MockCompiler compilerFor(String code, Uri uri) {
30 MockCompiler compiler = new MockCompiler(); 30 MockCompiler compiler = new MockCompiler();
31 compiler.sourceFiles[uri.toString()] = new SourceFile(uri.toString(), code); 31 compiler.sourceFiles[uri.toString()] = new SourceFile(uri.toString(), code);
32 return compiler; 32 return compiler;
33 } 33 }
34 34
35 String compileAll(String code) { 35 String compileAll(String code) {
36 Uri uri = new Uri.fromComponents(scheme: 'source'); 36 Uri uri = new Uri.fromComponents(scheme: 'source');
37 MockCompiler compiler = compilerFor(code, uri); 37 MockCompiler compiler = compilerFor(code, uri);
38 compiler.runCompiler(uri); 38 compiler.runCompiler(uri);
39 Expect.isFalse(compiler.compilationFailed,
40 'Unexpected compilation error');
39 return compiler.assembledCode; 41 return compiler.assembledCode;
40 } 42 }
41 43
42 lego.Element findElement(var compiler, String name) { 44 lego.Element findElement(var compiler, String name) {
43 var element = compiler.mainApp.find(buildSourceString(name)); 45 var element = compiler.mainApp.find(buildSourceString(name));
44 Expect.isNotNull(element, 'Could not locate $name.'); 46 Expect.isNotNull(element, 'Could not locate $name.');
45 return element; 47 return element;
46 } 48 }
47 49
48 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*"; 50 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*";
(...skipping 18 matching lines...) Expand all
67 String generated = compile(code, entry); 69 String generated = compile(code, entry);
68 Expect.isTrue(regexp.hasMatch(generated), 70 Expect.isTrue(regexp.hasMatch(generated),
69 '"$generated" does not match /$regexp/'); 71 '"$generated" does not match /$regexp/');
70 } 72 }
71 73
72 void compileAndDoNotMatch(String code, String entry, RegExp regexp) { 74 void compileAndDoNotMatch(String code, String entry, RegExp regexp) {
73 String generated = compile(code, entry); 75 String generated = compile(code, entry);
74 Expect.isFalse(regexp.hasMatch(generated), 76 Expect.isFalse(regexp.hasMatch(generated),
75 '"$generated" has a match in /$regexp/'); 77 '"$generated" has a match in /$regexp/');
76 } 78 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/scanner/scanner_task.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698