OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 | 6 |
7 class Base { | 7 class Base { |
8 int constant1000() => 1000; | 8 int constant1000() => 1000; |
9 } | 9 } |
10 | 10 |
11 class Foo extends Base { | 11 class Foo extends Base { |
12 final int base; | 12 final int base; |
13 Foo(this.base); | 13 Foo(this.base); |
14 | 14 |
15 nestedAdderFunction(a, b, c, d, e) { | 15 nestedAdderFunction(a, b, c, d, e) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 funs.add(() => i); | 56 funs.add(() => i); |
57 } | 57 } |
58 Expect.isTrue((funs[0]() + funs[1]() + funs[2]()) == 3); | 58 Expect.isTrue((funs[0]() + funs[1]() + funs[2]()) == 3); |
59 | 59 |
60 var funs2 = []; | 60 var funs2 = []; |
61 for (var i in [0, 1, 2]) { | 61 for (var i in [0, 1, 2]) { |
62 funs2.add(() => i); | 62 funs2.add(() => i); |
63 } | 63 } |
64 Expect.isTrue((funs2[0]() + funs2[1]() + funs2[2]()) == 3); | 64 Expect.isTrue((funs2[0]() + funs2[1]() + funs2[2]()) == 3); |
65 } | 65 } |
OLD | NEW |