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

Unified Diff: tests/kernel/unsorted/for_in_loop_test.dart

Issue 2451623006: Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork." (Closed)
Patch Set: Fix Created 4 years, 2 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/kernel/unsorted/for_in_loop_test.dart
diff --git a/tests/kernel/unsorted/for_in_loop_test.dart b/tests/kernel/unsorted/for_in_loop_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..223325f1d02d75bd52d94f34e1a6f00ce9dd1549
--- /dev/null
+++ b/tests/kernel/unsorted/for_in_loop_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2016, 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.
+
+// Tests of for-in loops and list literals.
+
+import 'expect.dart';
+
+fact4() {
+ var f = 1;
+ for (var n in [1, 2, 3, 4]) {
+ f *= n;
+ }
+ return f;
+}
+
+fact5() {
+ var f = 1, n;
+ for (n in [1, 2, 3, 4, 5]) {
+ f *= n;
+ }
+ return f;
+}
+
+var global;
+fact6() {
+ var f = 1;
+ for (global in [1, 2, 3, 4, 5, 6]) {
+ f *= global;
+ }
+ return f;
+}
+
+main() {
+ Expect.isTrue(fact4() == 24);
+ Expect.isTrue(fact5() == 120);
+ Expect.isTrue(fact6() == 720);
+}
« no previous file with comments | « tests/kernel/unsorted/finally_contexts_test.dart ('k') | tests/kernel/unsorted/getters_and_setters_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698