OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 |
| 5 main(arguments) { |
| 6 test1(f1); |
| 7 test2(f2); |
| 8 |
| 9 if (37 != v1) throw "Unexpected value: v1 = $v1, expected value: 37"; |
| 10 v1 = 42; |
| 11 if (42 != v1) throw "Unexpected value: v1 = $v1, expected value: 42"; |
| 12 if (v2 != null) throw "Unexpected value: v2 = $v2, expected value: null"; |
| 13 v2 = 42; |
| 14 if (42 != v2) throw "Unexpected value: v2 = $v2, expected value: 42"; |
| 15 setter = 37; |
| 16 if (37 != v1) throw "Unexpected value: v1 = $v1, expected value: 37"; |
| 17 if (37 != getter) |
| 18 throw "Unexpected getter value: v1 = ${getter}, expected value: 37"; |
| 19 } |
| 20 |
| 21 f1(a, [b = 10]) => a + b; |
| 22 f2(a, {b = 10}) => a + b; |
| 23 |
| 24 var v1 = 37; |
| 25 var v2; |
| 26 |
| 27 int get getter => v1; |
| 28 |
| 29 void set setter(int v) { |
| 30 v1 = v; |
| 31 } |
| 32 |
| 33 test1(Function f) { |
| 34 var result = f(40, 2); |
| 35 if (42 != result) throw "Unexpected result: $result"; |
| 36 } |
| 37 |
| 38 test2(Function f) { |
| 39 var result = f(40, b: 2); |
| 40 if (42 != result) throw "Unexpected result: $result"; |
| 41 } |
OLD | NEW |