Chromium Code Reviews| Index: tests/language/lazy_final_test.dart |
| diff --git a/tests/language/lazy_final_test.dart b/tests/language/lazy_final_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..28c038475b73b03c99e9b445d8e56aa4b4f76178 |
| --- /dev/null |
| +++ b/tests/language/lazy_final_test.dart |
| @@ -0,0 +1,38 @@ |
| +// Copyright (c) 2012, 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. |
| + |
| +final x = foo(); |
|
kasperl
2012/08/17 09:30:04
I guess we still need tests for the exceptional ca
floitsch
2012/09/04 17:32:21
Done.
|
| +final y = y2(y3); |
| +final y2 = incrementCreator(); |
| +final y3 = fib(5); |
| + |
| +foo() => 499; |
| + |
| +incrementCreator() => (x) => x + 1; |
| +fib(x) { |
| + if (x < 2) return x; |
| + return fib(x - 1) + fib(x - 2); |
| +} |
| + |
| +class A { |
| + static final a = toto(); |
| + static final b = b2(b3); |
| + static final b2 = decrementCreator(); |
| + static final b3 = fact(5); |
| + |
| + static toto() => 666; |
| + |
| + static decrementCreator() => (x) => x - 1; |
| + static fact(x) { |
| + if (x <= 1) return x; |
| + return x * fact(x - 1); |
| + } |
| +} |
| + |
| +main() { |
| + Expect.equals(499, x); |
| + Expect.equals(6, y); |
| + Expect.equals(666, A.a); |
| + Expect.equals(119, A.b); |
| +} |