| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 class Proxy { | 5 class Proxy { |
| 6 final proxied; | 6 final proxied; |
| 7 Proxy(this.proxied); | 7 Proxy(this.proxied); |
| 8 noSuchMethod(mirror) => mirror.invokeOn(proxied); | 8 noSuchMethod(mirror) => mirror.invokeOn(proxied); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 Expect.equals(87, list[1]); | 41 Expect.equals(87, list[1]); |
| 42 | 42 |
| 43 Expect.throws(() => proxy.funky(), (e) => e is NoSuchMethodError); | 43 Expect.throws(() => proxy.funky(), (e) => e is NoSuchMethodError); |
| 44 Expect.throws(() => list.funky(), (e) => e is NoSuchMethodError); | 44 Expect.throws(() => list.funky(), (e) => e is NoSuchMethodError); |
| 45 } | 45 } |
| 46 | 46 |
| 47 testString() { | 47 testString() { |
| 48 var string = "funky"; | 48 var string = "funky"; |
| 49 var proxy = new Proxy(string); | 49 var proxy = new Proxy(string); |
| 50 | 50 |
| 51 Expect.equals(string.charCodeAt(0), proxy.charCodeAt(0)); | 51 Expect.equals(string.codeUnitAt(0), proxy.codeUnitAt(0)); |
| 52 Expect.equals(string.length, proxy.length); | 52 Expect.equals(string.length, proxy.length); |
| 53 | 53 |
| 54 Expect.throws(() => proxy.funky(), (e) => e is NoSuchMethodError); | 54 Expect.throws(() => proxy.funky(), (e) => e is NoSuchMethodError); |
| 55 Expect.throws(() => string.funky(), (e) => e is NoSuchMethodError); | 55 Expect.throws(() => string.funky(), (e) => e is NoSuchMethodError); |
| 56 } | 56 } |
| 57 | 57 |
| 58 testInt() { | 58 testInt() { |
| 59 var number = 42; | 59 var number = 42; |
| 60 var proxy = new Proxy(number); | 60 var proxy = new Proxy(number); |
| 61 | 61 |
| 62 Expect.equals(number + 87, proxy + 87); | 62 Expect.equals(number + 87, proxy + 87); |
| 63 Expect.equals(number.toDouble(), proxy.toDouble()); | 63 Expect.equals(number.toDouble(), proxy.toDouble()); |
| 64 | 64 |
| 65 Expect.throws(() => proxy.funky(), (e) => e is NoSuchMethodError); | 65 Expect.throws(() => proxy.funky(), (e) => e is NoSuchMethodError); |
| 66 Expect.throws(() => number.funky(), (e) => e is NoSuchMethodError); | 66 Expect.throws(() => number.funky(), (e) => e is NoSuchMethodError); |
| 67 } | 67 } |
| 68 | 68 |
| 69 testDouble() { | 69 testDouble() { |
| 70 var number = 42.99; | 70 var number = 42.99; |
| 71 var proxy = new Proxy(number); | 71 var proxy = new Proxy(number); |
| 72 | 72 |
| 73 Expect.equals(number + 87, proxy + 87); | 73 Expect.equals(number + 87, proxy + 87); |
| 74 Expect.equals(number.toInt(), proxy.toInt()); | 74 Expect.equals(number.toInt(), proxy.toInt()); |
| 75 | 75 |
| 76 Expect.throws(() => proxy.funky(), (e) => e is NoSuchMethodError); | 76 Expect.throws(() => proxy.funky(), (e) => e is NoSuchMethodError); |
| 77 Expect.throws(() => number.funky(), (e) => e is NoSuchMethodError); | 77 Expect.throws(() => number.funky(), (e) => e is NoSuchMethodError); |
| 78 } | 78 } |
| OLD | NEW |