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

Unified Diff: tests/language/rewrite_while_test.dart

Issue 288343014: dart2dart: Test cases for better code coverage in dart_tree rewritings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
new file mode 100644
index 0000000000000000000000000000000000000000..8d9e3b6e1dde53250f9cd25a3732743acfb743a3
--- /dev/null
+++ b/tests/language/rewrite_while_test.dart
@@ -0,0 +1,39 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+f1(b) {
+ while (b)
+ return 1;
+
+ return 2;
+}
+
+f2(b) {
+ while (b) {
+ return 1;
+ }
+ return 2;
+}
+
+f3(n) {
+ var i = 0;
+ while (i < n) {
+ i = i + 1;
+ }
+ return i;
+}
+
+main() {
+ Expect.equals(1, f1(true));
+ Expect.equals(2, f1(false));
+ Expect.equals(1, f2(true));
+ Expect.equals(2, f2(false));
+ Expect.equals(0, f3(-2));
+ Expect.equals(0, f3(-1));
+ Expect.equals(0, f3(0));
+ Expect.equals(1, f3(1));
+ Expect.equals(2, f3(2));
+}
« tests/language/rewrite_assign_test.dart ('K') | « tests/language/rewrite_nested_if3_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698