| Index: tests/language/function_literals2_test.dart
|
| diff --git a/tests/language/function_literals2_test.dart b/tests/language/function_literals2_test.dart
|
| index 15be383df9342acd340c2c486869071a7153ce50..451a0a09e7ddd610948346627a0a2b5d2ead87c9 100644
|
| --- a/tests/language/function_literals2_test.dart
|
| +++ b/tests/language/function_literals2_test.dart
|
| @@ -7,24 +7,38 @@
|
| import "package:expect/expect.dart";
|
|
|
| class FunctionLiteralsTest {
|
| -
|
| static void testMain() {
|
| - f(x) { return x * 2;}
|
| - f(42); // make sure it is parsed as a function call
|
| + f(x) {
|
| + return x * 2;
|
| + }
|
| +
|
| + f(42); // make sure it is parsed as a function call
|
| Expect.equals(20, f(10));
|
|
|
| - int g(x) { return x * 2;}
|
| - g(42); // make sure it is parsed as a function call
|
| + int g(x) {
|
| + return x * 2;
|
| + }
|
| +
|
| + g(42); // make sure it is parsed as a function call
|
| Expect.equals(20, g(10));
|
|
|
| - h(x) { return x * 2;}
|
| - h(42); // make sure it is parsed as a function call
|
| + h(x) {
|
| + return x * 2;
|
| + }
|
| +
|
| + h(42); // make sure it is parsed as a function call
|
| Expect.equals(20, h(10));
|
|
|
| - var a = (x) {return x + 2;};
|
| + var a = (x) {
|
| + return x + 2;
|
| + };
|
| Expect.equals(7, a(5));
|
|
|
| - Expect.equals(10, apply((k) { return k << 1;}, 5));
|
| + Expect.equals(
|
| + 10,
|
| + apply((k) {
|
| + return k << 1;
|
| + }, 5));
|
| Expect.equals(20, apply((k) => k << 1, 10));
|
|
|
| a = new A(3);
|
| @@ -52,7 +66,7 @@ class FunctionLiteralsTest {
|
| int x = 0;
|
| int y = 1;
|
| // make sure this isn't parsed as a generic type
|
| - Expect.isTrue(x<y, "foo");
|
| + Expect.isTrue(x < y, "foo");
|
| }
|
| }
|
|
|
| @@ -65,21 +79,35 @@ bool isOdd(b) => b % 2 == 1;
|
| class A {
|
| int f;
|
| int f2;
|
| - A(p) : f = apply((j) => 2 - j, p) { /* constr. body */ f2 = -p; }
|
| - A.n(p) : f = 1 + apply((j) => 2 - j, p) { /* constr. body */ f2 = -f; }
|
| + A(p) : f = apply((j) => 2 - j, p) {
|
| + /* constr. body */
|
| + f2 = -p;
|
| + }
|
| + A.n(p) : f = 1 + apply((j) => 2 - j, p) {
|
| + /* constr. body */
|
| + f2 = -f;
|
| + }
|
| }
|
|
|
| class B {
|
| var f;
|
| int n;
|
| - B(z) : f = ((x) => x * x) { n = z; }
|
| - B.withZ(z) : f = ((x) { return x * x + 1; }) { n = z; }
|
| + B(z) : f = ((x) => x * x) {
|
| + n = z;
|
| + }
|
| + B.withZ(z)
|
| + : f = ((x) {
|
| + return x * x + 1;
|
| + }) {
|
| + n = z;
|
| + }
|
| }
|
|
|
| class C {
|
| String s;
|
| C(x) : s = "2*x is ${() { return 2*x; }()}";
|
| }
|
| +
|
| main() {
|
| FunctionLiteralsTest.testMain();
|
| }
|
|
|