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

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

Issue 175403002: GenerateNot was not respecting "generateAtUseSite". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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/dart2js.status ('k') | tests/language/logical_expression_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/logical_expression_test.dart
diff --git a/tests/compiler/dart2js/logical_expression_test.dart b/tests/compiler/dart2js/logical_expression_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cfc463395e304554b865ec0b7e637334acd5b0ad
--- /dev/null
+++ b/tests/compiler/dart2js/logical_expression_test.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
ngeoffray 2014/02/21 17:52:26 2012 -> 2014
floitsch 2014/02/21 18:35:26 Done.
+// 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.
+// Test that parameters keep their names in the output.
ngeoffray 2014/02/21 17:52:26 Re-comment.
floitsch 2014/02/21 18:35:26 Done.
+
+import "package:async_helper/async_helper.dart";
+import 'compiler_helper.dart';
+
+const String TEST_ONE = r"""
+foo(bar, gee) {
+ bool cond1 = bar();
+ if (cond1 || gee()) gee();
+ if (cond1 || gee()) gee();
+}
+""";
+
+const String TEST_TWO = r"""
+void foo(list, bar) {
+ if (list == null) bar();
+ if (list == null || bar()) bar();
+ if (list == null || bar()) bar();
+}
+""";
+
+main() {
+ // We want something like:
+ // var t1 = bar.call$0() === true;
+ // if (t1 || gee.call$0() === true) gee.call$0();
+ // if (t1 || gee.call$0() === true) gee.call$0();
+ compileAndDoNotMatchFuzzy(TEST_ONE, 'foo',
+ r"""var x = [a-zA-Z0-9$.]+\(\) == true;
+ if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;
+ if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;""");
+
+
+ // We want something like:
+ // var t1 = list == null;
+ // if (t1) bar.call$0();
+ // if (t1 || bar.call$0() === true) bar.call$0();
+ // if (t1 || bar.call$0() === true) bar.call$0();
+ compileAndMatchFuzzy(TEST_TWO, 'foo',
+ r"""var x = x == null;
+ if \(x\) [^;]+;
+ if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;
+ if \(x \|\| [a-zA-Z0-9$.]+\(\) === true\) [^;]+;""");
+}
« no previous file with comments | « tests/compiler/dart2js/dart2js.status ('k') | tests/language/logical_expression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698