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

Unified Diff: tests/utils/dummy_compiler_test.dart

Issue 362243003: Generate mock libraries and assert that helpers are non-null. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix after rebase. Created 6 years, 6 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/value_range_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/utils/dummy_compiler_test.dart
diff --git a/tests/utils/dummy_compiler_test.dart b/tests/utils/dummy_compiler_test.dart
index 60a5ed745892764acefee7d2f6dc16d0865e25c6..2405b7753bf6523befd4824ed8d59ec06a7a7ae9 100644
--- a/tests/utils/dummy_compiler_test.dart
+++ b/tests/utils/dummy_compiler_test.dart
@@ -12,98 +12,19 @@ import "package:async_helper/async_helper.dart";
import 'package:compiler/compiler.dart';
+import '../compiler/dart2js/mock_libraries.dart';
+
String libProvider(Uri uri) {
if (uri.path.endsWith("/core.dart")) {
- return """
-library core;
-class Object {
- Object();
- // Note: JSNull below must reimplement all members.
- operator==(other) {}
- get hashCode => throw 'Object.hashCode not implemented.';
-}
-class Type {}
-class bool {}
-class num {}
-class int {}
-class double{}
-class String{}
-class Function{}
-class List<E> {}
-class Map {}
-class Closure {}
-class BoundClosure {}
-class Dynamic_ {}
-class Null {}
-class StackTrace {}
-class LinkedHashMap {
- factory LinkedHashMap._empty() => null;
- factory LinkedHashMap._literal(elements) => null;
-}
-identical(a, b) => true;
-getRuntimeTypeInfo(o) {}
-setRuntimeTypeInfo(o, i) {}
-eqNull(a) {}
-eqNullB(a) {}
-const proxy = 0;""";
- } else if (uri.path.endsWith('_patch.dart')) {
- return """
-import 'dart:_js_helper';
-import 'dart:_interceptors';
-import 'dart:_isolate_helper';""";
+ return buildLibrarySource(DEFAULT_CORE_LIBRARY);
+ } else if (uri.path.endsWith('core_patch.dart')) {
+ return DEFAULT_PATCH_CORE_SOURCE;
} else if (uri.path.endsWith('interceptors.dart')) {
- return """
-class Interceptor {
- operator==(other) {}
- get hashCode => throw 'Interceptor.hashCode not implemented.';
-}
-abstract class JSIndexable {
- get length;
-}
-abstract class JSMutableIndexable {}
-abstract class JSArray<E> implements JSIndexable {
- JSArray() {}
- factory JSArray.typed(a) => a;
- var removeLast;
- var add;
-}
-abstract class JSMutableArray extends JSArray {}
-abstract class JSFixedArray extends JSMutableArray {}
-abstract class JSExtendableArray extends JSMutableArray {}
-class JSString implements JSIndexable {
- var split;
- var concat;
- operator+(other) {}
- var toString;
- get length => 0;
-}
-class JSFunction {}
-class JSInt {}
-class JSPositiveInt {}
-class JSUInt31 {}
-class JSUInt32 {}
-class JSDouble {}
-class JSNumber {}
-class JSNull {
- bool operator ==(other) => identical(null, other);
- int get hashCode => 0;
-}
-class JSBool {}
-getInterceptor(o){}
-getDispatchProperty(o) {}
-setDispatchProperty(o, v) {}
-var mapTypeToInterceptor;""";
+ return buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY);
} else if (uri.path.endsWith('js_helper.dart')) {
- return """
-library jshelper; class JSInvocationMirror {}
-class ConstantMap {} class TypeImpl {}
-createRuntimeType(String name) => null;
-class Closure {}
-class BoundClosure extends Closure {}
-const patch = 0;
-""";
+ return buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY);
} else if (uri.path.endsWith('isolate_helper.dart')) {
- return 'library isolatehelper; class _WorkerStub {}';
+ return buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY);
} else {
return "library lib${uri.path.replaceAll('/', '.')};";
}
@@ -141,6 +62,6 @@ main() {
throw 'Compilation failed';
}
}, onError: (e) {
- throw 'Compilation failed';
+ throw 'Compilation failed: $e';
}).then(asyncSuccess);
}
« no previous file with comments | « tests/compiler/dart2js/value_range_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698