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

Side by Side Diff: test/formatter_test.dart

Issue 1255643002: New, simpler and faster line splitter. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Optimize nesting. Reformat. Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « pubspec.yaml ('k') | test/regression/0100/0108.unit » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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 @TestOn("vm") 5 @TestOn("vm")
6 library dart_style.test.formatter_test; 6 library dart_style.test.formatter_test;
7 7
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:mirrors'; 9 import 'dart:mirrors';
10 10
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 equals("var i = 1;\n")); 111 equals("var i = 1;\n"));
112 }); 112 });
113 113
114 test('defaults to \\n if there are no newlines', () { 114 test('defaults to \\n if there are no newlines', () {
115 expect(new DartFormatter().format("var i =1;"), equals("var i = 1;\n")); 115 expect(new DartFormatter().format("var i =1;"), equals("var i = 1;\n"));
116 }); 116 });
117 117
118 test('handles Windows line endings in multiline strings', () { 118 test('handles Windows line endings in multiline strings', () {
119 expect( 119 expect(
120 new DartFormatter(lineEnding: "\r\n").formatStatement(' """first\r\n' 120 new DartFormatter(lineEnding: "\r\n").formatStatement(' """first\r\n'
121 'second\r\n' 121 'second\r\n'
122 'third""" ;'), equals('"""first\r\n' 122 'third""" ;'), equals('"""first\r\n'
123 'second\r\n' 123 'second\r\n'
124 'third""";')); 124 'third""";'));
125 }); 125 });
126 }); 126 });
127 } 127 }
128 128
129 /// Run tests defined in "*.unit" and "*.stmt" files inside directory [name]. 129 /// Run tests defined in "*.unit" and "*.stmt" files inside directory [name].
130 void testDirectory(String name) { 130 void testDirectory(String name) {
131 var indentPattern = new RegExp(r"^\(indent (\d+)\)\s*"); 131 var indentPattern = new RegExp(r"^\(indent (\d+)\)\s*");
132 132
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 source = source.replaceAll("‹", ""); 220 source = source.replaceAll("‹", "");
221 221
222 var end = source.indexOf("›"); 222 var end = source.indexOf("›");
223 source = source.replaceAll("›", ""); 223 source = source.replaceAll("›", "");
224 224
225 return new SourceCode(source, 225 return new SourceCode(source,
226 isCompilationUnit: isCompilationUnit, 226 isCompilationUnit: isCompilationUnit,
227 selectionStart: start == -1 ? null : start, 227 selectionStart: start == -1 ? null : start,
228 selectionLength: end == -1 ? null : end - start); 228 selectionLength: end == -1 ? null : end - start);
229 } 229 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | test/regression/0100/0108.unit » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698