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

Unified Diff: tests/language_strong/closure_shared_state_test.dart

Issue 3001433002: Migrating a block of dart 1 tests to dart 2 (Closed)
Patch Set: Fixed merge conflict characters Created 3 years, 4 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_strong/closure_shared_state_test.dart
diff --git a/tests/language_strong/closure_shared_state_test.dart b/tests/language_strong/closure_shared_state_test.dart
deleted file mode 100644
index 85c99085ad73a1b26ff27faafaef7eeba8667395..0000000000000000000000000000000000000000
--- a/tests/language_strong/closure_shared_state_test.dart
+++ /dev/null
@@ -1,76 +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.
-
-import "package:expect/expect.dart";
-
-// Tests for closures sharing mutable bindings.
-
-var f;
-var g;
-
-setupPlain() {
- int j = 1000;
- // Two closures sharing variable 'j'; j initially is 1000.
- f = (int x) {
- var q = j;
- j = x;
- return q;
- };
- g = (int x) {
- var q = j;
- j = x;
- return q;
- };
-}
-
-setupLoop() {
- for (int i = 0; i < 2; i++) {
- int j = i * 1000; // The last stored closure has j initially 1000.
- // Two closures sharing variable 'j'.
- f = (int x) {
- var q = j;
- j = x;
- return q;
- };
- g = (int x) {
- var q = j;
- j = x;
- return q;
- };
- }
-}
-
-setupNestedLoop() {
- for (int outer = 0; outer < 2; outer++) {
- int j = outer * 1000;
- for (int i = 0; i < 2; i++) {
- // Two closures sharing variable 'j' in a loop at different nesting.
- f = (int x) {
- var q = j;
- j = x;
- return q;
- };
- g = (int x) {
- var q = j;
- j = x;
- return q;
- };
- }
- }
-}
-
-test(setup) {
- setup();
- Expect.equals(1000, f(100));
- Expect.equals(100, f(200));
- Expect.equals(200, f(300));
- Expect.equals(300, g(400));
- Expect.equals(400, g(500));
-}
-
-main() {
- test(setupPlain);
- test(setupLoop);
- test(setupNestedLoop);
-}
« no previous file with comments | « tests/language_strong/closure_self_reference_test.dart ('k') | tests/language_strong/language_strong.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698