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

Unified Diff: tests/language/rewrite_while_test.dart

Issue 318723002: dart2dart: Restore loops with conditions and updates in backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Kevin's comments + bugfix Created 6 years, 6 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
Index: tests/language/rewrite_while_test.dart
diff --git a/tests/language/rewrite_while_test.dart b/tests/language/rewrite_while_test.dart
index 44e72eda8d93139a0035599eadf82ef2fa2b0791..18c6539318561e2600d5def9fcbef69d3f03802d 100644
--- a/tests/language/rewrite_while_test.dart
+++ b/tests/language/rewrite_while_test.dart
@@ -26,6 +26,18 @@ loop2(x) {
return n;
}
+loop3(x) {
+ var n = 0;
+ if (x < 100) {
+ while (n < x) {
+ n = n + 1;
+ baz();
+ }
+ }
+ baz();
+ return n;
+}
+
f1(b) {
while (b)
return 1;
@@ -48,6 +60,10 @@ main() {
Expect.equals(10, loop2(10));
Expect.equals(0, loop2(200));
+ Expect.equals(0, loop3(-10));
+ Expect.equals(10, loop3(10));
+ Expect.equals(0, loop3(200));
+
Expect.equals(1, f1(true));
Expect.equals(2, f1(false));
Expect.equals(1, f2(true));

Powered by Google App Engine
This is Rietveld 408576698