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

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

Issue 9916001: Fix LocalFunctionTest and update status files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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
« tests/language/language-leg.status ('K') | « tests/language/language-leg.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/src/LocalFunctionTest.dart
diff --git a/tests/language/src/LocalFunctionTest.dart b/tests/language/src/LocalFunctionTest.dart
index 57c3168fca30e8838140bd4e0bd1803cb335b9c8..2ba16b5182ff5994ce6ac07154241bdfc0d310f6 100644
--- a/tests/language/src/LocalFunctionTest.dart
+++ b/tests/language/src/LocalFunctionTest.dart
@@ -18,7 +18,8 @@ class LocalFunctionTest {
k(int n) {
var a = new List(n);
var b = new List(n);
- for (int i = 0; i < n; i++) {
+ int i;
+ for (i = 0; i < n; i++) {
var j = i;
a[i] = () => i; // Captured i is always n.
b[i] = () => j; // Captured j varies from 0 to n-1.
@@ -33,6 +34,25 @@ class LocalFunctionTest {
}
return k(n);
}
+ static int h2(int n) {
+ k(int n) {
+ var a = new List(n);
+ var b = new List(n);
+ for (int i = 0; i < n; i++) {
+ var j = i;
+ a[i] = () => i; // Captured i varies from 0 to n-1.
+ b[i] = () => j; // Captured j varies from 0 to n-1.
+ }
+ var a_sum = 0;
+ var b_sum = 0;
+ for (int i = 0; i < n; i++) {
+ a_sum += a[i]();
+ b_sum += b[i]();
+ }
+ return a_sum + b_sum;
+ }
+ return k(n);
+ }
int field1;
int field2_;
int get field2() { return field2_; }
@@ -164,6 +184,7 @@ class LocalFunctionTest {
static testMain() {
Expect.equals(2*(3*2 + 2 + 1), f(2));
Expect.equals(10*10 + 10*9/2, h(10));
+ Expect.equals(90, h2(10));
Expect.equals(320, new LocalFunctionTest().method(10));
Expect.equals(145, new LocalFunctionTest().testExecute(10));
Expect.equals(5, testSelfReference1(5));
« tests/language/language-leg.status ('K') | « tests/language/language-leg.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698