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

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

Issue 737353002: cps-ir: Implement boolean conversion in and use it to implement '&&', '||', and '?:'. (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
index df21e239e9825f043c0d19478d6a0a47c1e64cb8..68df2f10ffdb6776199eac45ce5f7e77e5813b3f 100644
--- a/tests/compiler/dart2js/js_backend_cps_ir_test.dart
+++ b/tests/compiler/dart2js/js_backend_cps_ir_test.dart
@@ -68,6 +68,39 @@ main() { return foo(); }
function() {
return null;
}"""),
+ const TestEntry("main() { return true ? 42 : 'foo'; }"),
+ const TestEntry("""
+foo() => foo;
+main() {
+ print(foo() ? "hello world" : "bad bad");
+}""",
+"""function() {
+ P.print(P.identical(V.foo(), true) ? "hello world" : "bad bad");
+ return null;
+}"""),
+ const TestEntry("""
+get foo => foo;
+main() {
+ print(foo ? "hello world" : "bad bad");
+}""",
+"""function() {
+ P.print(P.identical(V.foo(), true) ? "hello world" : "bad bad");
+ return null;
+}"""),
+ const TestEntry("""
+get foo => foo;
+main() { print(foo && foo); }""",
+"""function() {
+ P.print(P.identical(V.foo(), true) && P.identical(V.foo(), true));
+ return null;
+}"""),
+ const TestEntry("""
+get foo => foo;
+main() { print(foo || foo); }""",
+"""function() {
+ P.print(P.identical(V.foo(), true) || P.identical(V.foo(), true));
+ return null;
+}"""),
];
String formatTest(Map test) {
@@ -92,7 +125,11 @@ main() {
Expect.isNotNull(compiler.assembledCode);
String expectation = test.expectation;
if (expectation != null) {
- Expect.equals(test.expectation, getCodeForMain(compiler));
+ String expected = test.expectation;
+ String found = getCodeForMain(compiler);
+ if (expected != found) {
+ Expect.fail('Expected:\n$expected\nbut found\n$found');
+ }
}
}).catchError((e) {
print(e);

Powered by Google App Engine
This is Rietveld 408576698