| 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 library test.reflect_model_test; | 5 library test.reflect_model_test; |
| 6 | 6 |
| 7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
| 8 | 8 |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 Expect.equals(42, a.setField(field, 42).reflectee); | 40 Expect.equals(42, a.setField(field, 42).reflectee); |
| 41 Expect.equals(87, b.setField(field, 87).reflectee); | 41 Expect.equals(87, b.setField(field, 87).reflectee); |
| 42 Expect.equals(89, c.setField(field, 89).reflectee); | 42 Expect.equals(89, c.setField(field, 89).reflectee); |
| 43 | 43 |
| 44 Expect.equals(42, a.getField(field).reflectee); | 44 Expect.equals(42, a.getField(field).reflectee); |
| 45 Expect.equals('B:get field', b.getField(field).reflectee); | 45 Expect.equals('B:get field', b.getField(field).reflectee); |
| 46 Expect.equals('B:get field', c.getField(field).reflectee); | 46 Expect.equals('B:get field', c.getField(field).reflectee); |
| 47 Expect.equals(89, fieldC); | 47 Expect.equals(89, fieldC); |
| 48 | 48 |
| 49 expect('{accessor: Method(s(accessor) in s(A), getter)' | 49 expect('{accessor: Method(s(accessor) in s(A), getter)' |
| 50 // TODO(ahe): Include instance field getters? | |
| 51 ', field: Method(s(field) in s(A), getter)' | |
| 52 '}', | 50 '}', |
| 53 aClass.getters); | 51 aClass.getters); |
| 54 expect('{accessor: Method(s(accessor) in s(B), getter)' | 52 expect('{accessor: Method(s(accessor) in s(B), getter)' |
| 55 ', field: Method(s(field) in s(B), getter)}', | 53 ', field: Method(s(field) in s(B), getter)}', |
| 56 bClass.getters); | 54 bClass.getters); |
| 57 expect('{accessor: Method(s(accessor) in s(C), getter)}', | 55 expect('{accessor: Method(s(accessor) in s(C), getter)}', |
| 58 cClass.getters); | 56 cClass.getters); |
| 59 | 57 |
| 60 expect('{accessor=: Method(s(accessor=) in s(A), setter)' | 58 expect('{accessor=: Method(s(accessor=) in s(A), setter)' |
| 61 // TODO(ahe): Include instance field setters? | |
| 62 ', field=: Method(s(field=) in s(A), setter)' | |
| 63 '}', | 59 '}', |
| 64 aClass.setters); | 60 aClass.setters); |
| 65 expect('{accessor=: Method(s(accessor=) in s(B), setter)}', | 61 expect('{accessor=: Method(s(accessor=) in s(B), setter)}', |
| 66 bClass.setters); | 62 bClass.setters); |
| 67 expect('{accessor=: Method(s(accessor=) in s(C), setter)' | 63 expect('{accessor=: Method(s(accessor=) in s(C), setter)' |
| 68 ', field=: Method(s(field=) in s(C), setter)}', | 64 ', field=: Method(s(field=) in s(C), setter)}', |
| 69 cClass.setters); | 65 cClass.setters); |
| 70 | 66 |
| 71 Expect.equals('A:instanceMethod(7)', a.invoke(instanceMethod, [7]).reflectee); | 67 Expect.equals('A:instanceMethod(7)', a.invoke(instanceMethod, [7]).reflectee); |
| 72 Expect.equals('B:instanceMethod(9)', b.invoke(instanceMethod, [9]).reflectee); | 68 Expect.equals('B:instanceMethod(9)', b.invoke(instanceMethod, [9]).reflectee); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 Expect.equals('aMethod', c.invoke(aMethod, []).reflectee); | 100 Expect.equals('aMethod', c.invoke(aMethod, []).reflectee); |
| 105 | 101 |
| 106 Expect.throws(() { a.invoke(bMethod, []); }, isNoSuchMethodError); | 102 Expect.throws(() { a.invoke(bMethod, []); }, isNoSuchMethodError); |
| 107 Expect.equals('bMethod', b.invoke(bMethod, []).reflectee); | 103 Expect.equals('bMethod', b.invoke(bMethod, []).reflectee); |
| 108 Expect.equals('bMethod', c.invoke(bMethod, []).reflectee); | 104 Expect.equals('bMethod', c.invoke(bMethod, []).reflectee); |
| 109 | 105 |
| 110 Expect.throws(() { a.invoke(cMethod, []); }, isNoSuchMethodError); | 106 Expect.throws(() { a.invoke(cMethod, []); }, isNoSuchMethodError); |
| 111 Expect.throws(() { b.invoke(cMethod, []); }, isNoSuchMethodError); | 107 Expect.throws(() { b.invoke(cMethod, []); }, isNoSuchMethodError); |
| 112 Expect.equals('cMethod', c.invoke(cMethod, []).reflectee); | 108 Expect.equals('cMethod', c.invoke(cMethod, []).reflectee); |
| 113 } | 109 } |
| OLD | NEW |