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

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: Fix two checked mode issues. 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.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_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..80398fe41c7498ac62d14768b7771079877d537c
--- /dev/null
+++ b/tests/compiler/dart2js/js_backend_cps_ir_test.dart
@@ -0,0 +1,45 @@
+// 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 'package:compiler/src/apiimpl.dart'
+ show Compiler;
+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"));
+
+ Iterable<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.isNotNull(compiler.assembledCode);
+ }).catchError((e) {
+ Expect.fail('The following test failed to compile:\n'
+ '${formatTest(test)}');
+ });
+ });
+ }
+}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698