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

Unified Diff: tests/language/src/For2Test.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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/language/src/FirstTest.dart ('k') | tests/language/src/ForInTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/src/For2Test.dart
diff --git a/tests/language/src/For2Test.dart b/tests/language/src/For2Test.dart
deleted file mode 100644
index 7477565870cc708f64852a27570faaf0bde68c67..0000000000000000000000000000000000000000
--- a/tests/language/src/For2Test.dart
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2011, 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.
-// Dart test program for testing for statement which captures loop variable.
-
-var f;
-
-main() {
- // Capture the loop variable, ensure we capture the right value.
- for (int i = 0; i < 10; i++) {
- if (i == 7) {
- f = () => "i = $i";
- }
- }
- Expect.equals("i = 7", f());
-
- // There is only one instance of k. The captured variable continues
- // to change.
- int k;
- for (k = 0; k < 10; k++) {
- if (k == 7) {
- f = () => "k = $k";
- }
- }
- Expect.equals("k = 10", f());
-
- // l gets modified after it's captured. n++ is executed on the
- // newly introduced instance of n (i.e. the instance of the loop
- // iteration after the value is captured).
- for (int n = 0; n < 10; n++) {
- var l = n;
- if (l == 7) {
- f = () => "l = $l, n = $n";
- }
- l++;
- }
- Expect.equals("l = 8, n = 7", f());
-
- // Loop variable is incremented in loop body instead of the increment.
- // expression. Thus, the captured value is incremented by one before
- // a new loop variable instance is created.
- for (int i = 0; i < 10; /*nothing*/) {
- if (i == 7) {
- f = () => "i = $i";
- }
- i++;
- }
- Expect.equals("i = 8", f());
-
- // Make sure continue still ensures the loop variable is captured correctly.
- for (int i = 0; i < 10; i++) {
- if (i == 7) {
- f = () => "i = $i";
- }
- continue;
- i++;
- }
- Expect.equals("i = 7", f());
-
- // Nested loops with captured variables.
- for (int k = 0; k < 5; k++) {
- for (int i = 0; i < 10; i++) {
- if (k == 3 && i == 7) {
- f = () => "k = $k, i = $i";
- }
- }
- }
- Expect.equals("k = 3, i = 7", f());
-}
« no previous file with comments | « tests/language/src/FirstTest.dart ('k') | tests/language/src/ForInTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698