Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: tests/lib/mirrors/delegate_function_invocation_test.dart

Issue 3011633002: Added back helper file accidentally deleted during test block 219 migration. (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 file.
4
5 library test.delegate_function_invocation;
6
7 @MirrorsUsed(targets: "test.delegate_function_invocation")
8 import 'dart:mirrors';
9
10 import 'package:expect/expect.dart';
11
12 class Proxy {
13 var targetMirror;
14 Proxy(target) : this.targetMirror = reflect(target);
15 noSuchMethod(invocation) => targetMirror.delegate(invocation);
16 }
17
18 testClosure() {
19 var proxy = new Proxy(() => 42);
20 Expect.equals(42, proxy());
21 Expect.equals(42, proxy.call());
22 }
23
24 class FakeFunction {
25 call() => 43;
26 }
27
28 testFakeFunction() {
29 var proxy = new Proxy(new FakeFunction());
30 Expect.equals(43, proxy());
31 Expect.equals(43, proxy.call());
32 }
33
34 topLevelFunction() => 44;
35
36 testTopLevelTearOff() {
37 var proxy = new Proxy(topLevelFunction);
38 Expect.equals(44, proxy());
39 Expect.equals(44, proxy.call());
40 }
41
42 class C {
43 method() => 45;
44 }
45
46 testInstanceTearOff() {
47 var proxy = new Proxy(new C().method);
48 Expect.equals(45, proxy());
49 Expect.equals(45, proxy.call());
50 }
51
52 main() {
53 testClosure();
54 testFakeFunction();
55 testTopLevelTearOff();
56 testInstanceTearOff();
57 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/delegate_class_test.dart ('k') | tests/lib/mirrors/delegate_library_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698