OLD | NEW |
1 // Copyright 2013 Google Inc. All Rights Reserved. | 1 // Copyright 2013 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 new isInstanceOf<MethodMirror>()); | 69 new isInstanceOf<MethodMirror>()); |
70 expect(getDeclaration(mirror, const Symbol('a')), | 70 expect(getDeclaration(mirror, const Symbol('a')), |
71 new isInstanceOf<VariableMirror>()); | 71 new isInstanceOf<VariableMirror>()); |
72 }); | 72 }); |
73 }); | 73 }); |
74 | 74 |
75 group('Method', () { | 75 group('Method', () { |
76 test('should be callable', () { | 76 test('should be callable', () { |
77 var i = 2; | 77 var i = 2; |
78 var mirror = reflect(i); | 78 var mirror = reflect(i); |
79 var method = new Method(mirror, const Symbol('+')); | 79 var method = new Method(mirror, const Symbol('+')) as dynamic; |
80 expect(method(3), 5); | 80 expect(method(3), 5); |
81 }); | 81 }); |
82 | 82 |
83 test('should be callable with named arguments', () { | 83 test('should be callable with named arguments', () { |
84 // this test will fail when named argument support is added | 84 // this test will fail when named argument support is added |
85 var i = [1, 2]; | 85 var i = [1, 2]; |
86 var mirror = reflect(i); | 86 var mirror = reflect(i); |
87 var method = new Method(mirror, const Symbol('toList')); | 87 var method = new Method(mirror, const Symbol('toList')) as dynamic; |
88 expect(method(growable: false), [1, 2]); | 88 expect(method(growable: false), [1, 2]); |
89 }); | 89 }); |
90 }); | 90 }); |
91 } | 91 } |
92 | 92 |
93 class Foo extends IterableBase implements Comparable { | 93 class Foo extends IterableBase implements Comparable { |
94 String a; | 94 String a; |
95 get iterator => null; | 95 get iterator => null; |
96 int compareTo(o) => 0; | 96 int compareTo(o) => 0; |
97 } | 97 } |
OLD | NEW |