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

Unified Diff: tests/lib/mirrors/method_mirror_source_line_ending_test.dart

Issue 132773006: Fix handling of CRLF line endings in Script::GetSnippet. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: appease analyzer Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/lib/mirrors/method_mirror_source_line_ending_lf.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/method_mirror_source_line_ending_test.dart
diff --git a/tests/lib/mirrors/method_mirror_source_line_ending_test.dart b/tests/lib/mirrors/method_mirror_source_line_ending_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e052cc10a95510fa40c0e378f691763a7fde26bc
--- /dev/null
+++ b/tests/lib/mirrors/method_mirror_source_line_ending_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:mirrors";
+import "package:expect/expect.dart";
+
+import "method_mirror_source_line_ending_lf.dart";
+import "method_mirror_source_line_ending_cr.dart";
+import "method_mirror_source_line_ending_crlf.dart";
+
+main() {
+ String sourceOf(Function f) => (reflect(f) as ClosureMirror).function.source;
+
+ // Source does not cross line breaks.
+ Expect.stringEquals('oneLineLF(x) => x;', sourceOf(oneLineLF));
+ Expect.stringEquals('oneLineCR(x) => x;', sourceOf(oneLineCR));
+ Expect.stringEquals('oneLineCRLF(x) => x;', sourceOf(oneLineCRLF));
+
+ // Source includes line breaks.
+ Expect.stringEquals('multiLineLF(y) {\n return y + 1;\n}',
+ sourceOf(multiLineLF));
+ Expect.stringEquals('multiLineCR(y) {\r return y + 1;\r}',
+ sourceOf(multiLineCR));
+ Expect.stringEquals('multiLineCRLF(y) {\r\n return y + 1;\r\n}',
+ sourceOf(multiLineCRLF));
+
+ // First and last characters separated from middle by line breaks.
+ Expect.stringEquals('a\n(){\n}', sourceOf(a));
+ Expect.stringEquals('b\r(){\r}', sourceOf(b));
+ Expect.stringEquals('c\r\n(){\r\n}', sourceOf(c));
+}
« no previous file with comments | « tests/lib/mirrors/method_mirror_source_line_ending_lf.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698