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

Unified Diff: test/formatter_test.dart

Issue 840113002: Handle Windows line endings in multi-line strings. Fix #126. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 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 | « lib/src/source_visitor.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/formatter_test.dart
diff --git a/test/formatter_test.dart b/test/formatter_test.dart
index e35c6d3b0fe3ba6dad6d99e2f5a42597f907c486..4d4682896affd23da570fc99baaed2e5cdc26c62 100644
--- a/test/formatter_test.dart
+++ b/test/formatter_test.dart
@@ -117,22 +117,32 @@ void main() {
group('line endings', () {
test('uses given line ending', () {
expect(new DartFormatter(lineEnding: "%").format("var i = 1;"),
- equals("var i = 1;%"));
+ equals("var i = 1;%"));
});
test('infers \\r\\n if the first newline uses that', () {
expect(new DartFormatter().format("var\r\ni\n=\n1;\n"),
- equals("var i = 1;\r\n"));
+ equals("var i = 1;\r\n"));
});
test('infers \\n if the first newline uses that', () {
expect(new DartFormatter().format("var\ni\r\n=\r\n1;\r\n"),
- equals("var i = 1;\n"));
+ equals("var i = 1;\n"));
});
test('defaults to \\n if there are no newlines', () {
expect(new DartFormatter().format("var i =1;"),
- equals("var i = 1;\n"));
+ equals("var i = 1;\n"));
+ });
+
+ test('handles Windows line endings in multiline strings', () {
+ expect(new DartFormatter(lineEnding: "\r\n").formatStatement(
+ ' """first\r\n'
+ 'second\r\n'
+ 'third""" ;'), equals(
+ '"""first\r\n'
+ 'second\r\n'
+ 'third""";'));
});
});
}
« no previous file with comments | « lib/src/source_visitor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698