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 // Note: This test relies on LF line endings in the source file. |
| 6 |
5 import "dart:mirrors"; | 7 import "dart:mirrors"; |
6 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
7 import "method_mirror_source_other.dart"; | 9 import "method_mirror_source_other.dart"; |
8 | 10 |
9 expectSource(Mirror mirror, String source) { | 11 expectSource(Mirror mirror, String source) { |
10 MethodMirror methodMirror; | 12 MethodMirror methodMirror; |
11 if (mirror is ClosureMirror) { | 13 if (mirror is ClosureMirror) { |
12 methodMirror = mirror.function; | 14 methodMirror = mirror.function; |
13 } else { | 15 } else { |
14 methodMirror = mirror as MethodMirror; | 16 methodMirror = mirror as MethodMirror; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 expectSource(reflect(namedClosure), "namedClosure(x,y,z) => 1;"); | 101 expectSource(reflect(namedClosure), "namedClosure(x,y,z) => 1;"); |
100 expectSource(reflect(a), "() {}"); | 102 expectSource(reflect(a), "() {}"); |
101 | 103 |
102 // Function at first line. | 104 // Function at first line. |
103 LibraryMirror otherLib = reflectClass(SomethingInOther).owner; | 105 LibraryMirror otherLib = reflectClass(SomethingInOther).owner; |
104 expectSource(otherLib.declarations[#main], | 106 expectSource(otherLib.declarations[#main], |
105 """main() { | 107 """main() { |
106 print("Blah"); | 108 print("Blah"); |
107 }"""); | 109 }"""); |
108 } | 110 } |
OLD | NEW |