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

Unified Diff: tests/compiler/dart2js/mock_compiler.dart

Issue 1320913002: dart2js: Add test to compile empty main without any libraries. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/dart2js.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/mock_compiler.dart
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index af3ef8212a5e4ef67ed7c5056fdf4752664152dd..3f33c7e9d497e0ae58e9a006c170e91d950ebafb 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -50,6 +50,8 @@ class WarningMessage {
final Uri PATCH_CORE = new Uri(scheme: 'patch', path: 'core');
+typedef String LibrarySourceProvider(Uri uri);
+
class MockCompiler extends Compiler {
api.DiagnosticHandler diagnosticHandler;
List<WarningMessage> warnings;
@@ -65,6 +67,7 @@ class MockCompiler extends Compiler {
final Map<String, SourceFile> sourceFiles;
Node parsedTree;
final String testedPatchVersion;
+ final LibrarySourceProvider librariesOverride;
MockCompiler.internal(
{Map<String, String> coreSource,
@@ -85,7 +88,8 @@ class MockCompiler extends Compiler {
int this.expectedWarnings,
int this.expectedErrors,
api.CompilerOutputProvider outputProvider,
- String patchVersion})
+ String patchVersion,
+ LibrarySourceProvider this.librariesOverride})
: sourceFiles = new Map<String, SourceFile>(),
testedPatchVersion = patchVersion,
super(enableTypeAssertions: enableTypeAssertions,
@@ -167,9 +171,16 @@ class MockCompiler extends Compiler {
/**
* Registers the [source] with [uri] making it possible load [source] as a
- * library.
+ * library. If an override has been provided in [librariesOverride], that
+ * is used instead.
*/
void registerSource(Uri uri, String source) {
+ if (librariesOverride != null) {
+ String override = librariesOverride(uri);
+ if (override != null) {
+ source = override;
+ }
+ }
sourceFiles[uri.toString()] = new MockFile(source);
}
« no previous file with comments | « tests/compiler/dart2js/dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698