| OLD | NEW |
| (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 import "dart:mirrors"; |
| 6 import "package:expect/expect.dart"; |
| 7 |
| 8 import "method_mirror_source_line_ending_lf.dart"; |
| 9 import "method_mirror_source_line_ending_cr.dart"; |
| 10 import "method_mirror_source_line_ending_crlf.dart"; |
| 11 |
| 12 main() { |
| 13 String sourceOf(Function f) => (reflect(f) as ClosureMirror).function.source; |
| 14 |
| 15 // Source does not cross line breaks. |
| 16 Expect.stringEquals('oneLineLF(x) => x;', sourceOf(oneLineLF)); |
| 17 Expect.stringEquals('oneLineCR(x) => x;', sourceOf(oneLineCR)); |
| 18 Expect.stringEquals('oneLineCRLF(x) => x;', sourceOf(oneLineCRLF)); |
| 19 |
| 20 // Source includes line breaks. |
| 21 Expect.stringEquals('multiLineLF(y) {\n return y + 1;\n}', |
| 22 sourceOf(multiLineLF)); |
| 23 Expect.stringEquals('multiLineCR(y) {\r return y + 1;\r}', |
| 24 sourceOf(multiLineCR)); |
| 25 Expect.stringEquals('multiLineCRLF(y) {\r\n return y + 1;\r\n}', |
| 26 sourceOf(multiLineCRLF)); |
| 27 |
| 28 // First and last characters separated from middle by line breaks. |
| 29 Expect.stringEquals('a\n(){\n}', sourceOf(a)); |
| 30 Expect.stringEquals('b\r(){\r}', sourceOf(b)); |
| 31 Expect.stringEquals('c\r\n(){\r\n}', sourceOf(c)); |
| 32 } |
| OLD | NEW |