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

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

Issue 733053004: cps-ir: Add a test for codegeneration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
Index: tests/compiler/dart2js/js_backend_cps_ir_test.dart
diff --git a/tests/compiler/dart2js/js_backend_cps_ir_test.dart b/tests/compiler/dart2js/js_backend_cps_ir_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5bf95abb7785286602ae5f88aa0a7f9f0b1283aa
--- /dev/null
+++ b/tests/compiler/dart2js/js_backend_cps_ir_test.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=-DUSE_CPS_IR=true
+
+// Test that the CPS IR code generator is able to compile the provided
+// example programs.
+
+import 'package:async_helper/async_helper.dart';
+import 'package:expect/expect.dart';
+import 'memory_compiler.dart';
+
+const String TEST_MAIN_FILE = 'test.dart';
+
+/// The list of tests to run.
+const List<String> RAW_TESTS = const [
+ "main() {}",
+ "main() { return 42; }",
+];
+
+String formatTest(Map test) {
+ return test[TEST_MAIN_FILE];
+}
+
+main() {
+ Expect.isTrue(const bool.fromEnvironment("USE_CPS_IR"));
+
+ List<Map> tests =
+ RAW_TESTS.map((String text) => {TEST_MAIN_FILE: text});
+
+ for (Map test in tests) {
+ asyncTest(() {
+ Compiler compiler = compilerFor(test);
+ Uri uri = Uri.parse('memory:$TEST_MAIN_FILE');
+ return compiler.run(uri).then((_) {
+ Expect.isTrue(compiler.assembledCode != null);
floitsch 2014/11/17 15:03:30 Expect.isNotNull(...)
floitsch 2014/11/17 15:03:30 indent+, or indent- in the next line.
karlklose 2014/11/17 16:11:58 Done.
karlklose 2014/11/17 16:11:58 Done.
+ }).catchError((_) {
+ print('The following test failed to compile:\n'
+ '${formatTest(test)}');
+ Expect.isTrue(false);
floitsch 2014/11/17 15:03:30 Expect.fail(...)
karlklose 2014/11/17 16:11:58 Done.
+ });
+ });
+ }
+}
« pkg/compiler/lib/src/ssa/codegen.dart ('K') | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698