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

Unified Diff: tests/compiler/dart2js/js_model/model_test.dart

Issue 2967933002: Bring js_model/model_test on par with compile_from_dill tests. (Closed)
Patch Set: Created 3 years, 5 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
« pkg/compiler/lib/src/world.dart ('K') | « pkg/compiler/lib/src/world.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/js_model/model_test.dart
diff --git a/tests/compiler/dart2js/js_model/model_test.dart b/tests/compiler/dart2js/js_model/model_test.dart
index d1bed70961a16c2f5145d42f7ffbcef6f034a249..329d1f162b8c2e807861b63af3173aebcc94b2f7 100644
--- a/tests/compiler/dart2js/js_model/model_test.dart
+++ b/tests/compiler/dart2js/js_model/model_test.dart
@@ -10,49 +10,10 @@ import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
import 'package:compiler/src/js_model/js_strategy.dart';
import 'package:expect/expect.dart';
+import '../kernel/compile_from_dill_test_helper.dart';
import '../kernel/compiler_helper.dart';
import '../serialization/helper.dart';
-const Map<String, String> SOURCE = const <String, String>{
- 'main.dart': r'''
-foo({named}) => 1;
-bar(a) => !a;
-class Class {
- var field;
- static var staticField;
-
- Class();
- Class.named(this.field);
-
- method() {}
-}
-
-class SubClass extends Class {
- method() {
- super.method();
- }
-}
-
-main() {
- foo();
- bar(true);
- [];
- {};
- new Object();
- new Class.named('');
- new SubClass().method();
- Class.staticField;
- var x = null;
- var y1 = x == null;
- var y2 = null == x;
- var z1 = x?.toString();
- var z2 = x ?? y1;
- var z3 = x ??= y2;
- return x;
-}
-'''
-};
-
main(List<String> args) {
useJsStrategyForTesting = true;
asyncTest(() async {
@@ -61,25 +22,34 @@ main(List<String> args) {
}
Future mainInternal(List<String> args,
- {bool skipWarnings: false, bool skipErrors: false}) async {
+ {bool skipWarnings: false,
+ bool skipErrors: false,
+ List<String> options: const <String>[]}) async {
Arguments arguments = new Arguments.from(args);
- Uri entryPoint;
- Map<String, String> memorySourceFiles;
+ List<Test> tests;
if (arguments.uri != null) {
- entryPoint = arguments.uri;
- memorySourceFiles = const <String, String>{};
+ tests = <Test>[new Test.fromUri(arguments.uri)];
} else {
- entryPoint = Uri.parse('memory:main.dart');
- memorySourceFiles = SOURCE;
+ tests = TESTS;
+ }
+ for (Test test in tests) {
+ if (test.uri != null) {
+ print('--- running test uri ${test.uri} -------------------------------');
+ } else {
+ print(
+ '--- running test code -------------------------------------------');
+ print(test.sources.values.first);
+ print('----------------------------------------------------------------');
+ }
+
+ enableDebugMode();
+
+ Compiler compiler1 = await compileWithDill(test.entryPoint, test.sources, [
+ Flags.disableInlining,
+ Flags.disableTypeInference
+ ], beforeRun: (Compiler compiler) {
+ compiler.backendStrategy = new JsBackendStrategy(compiler);
+ }, printSteps: true);
+ Expect.isFalse(compiler1.compilationFailed);
}
-
- enableDebugMode();
-
- Compiler compiler1 = await compileWithDill(entryPoint, memorySourceFiles, [
- Flags.disableInlining,
- Flags.disableTypeInference
- ], beforeRun: (Compiler compiler) {
- compiler.backendStrategy = new JsBackendStrategy(compiler);
- }, printSteps: true);
- Expect.isFalse(compiler1.compilationFailed);
}
« pkg/compiler/lib/src/world.dart ('K') | « pkg/compiler/lib/src/world.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698