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

Unified Diff: pkg/analyzer/test/src/task/options_test.dart

Issue 1413783005: `LineInfo` line-end detection fixes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Tests. Created 5 years, 2 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 | « pkg/analyzer/lib/src/task/options.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/options_test.dart
diff --git a/pkg/analyzer/test/src/task/options_test.dart b/pkg/analyzer/test/src/task/options_test.dart
index 5dddc259ffec9b9a79d6b6c19aaf2840cef9b67d..bf58d00cef58a0a5bed0550209dbe47b58d7aeae 100644
--- a/pkg/analyzer/test/src/task/options_test.dart
+++ b/pkg/analyzer/test/src/task/options_test.dart
@@ -32,6 +32,9 @@ class GenerateOptionsErrorsTaskTest extends AbstractContextTest {
final optionsFilePath = '/${AnalysisEngine.ANALYSIS_OPTIONS_FILE}';
Source source;
+ LineInfo lineInfo(String source) =>
+ GenerateOptionsErrorsTask.computeLineInfo(source);
+
@override
setUp() {
super.setUp();
@@ -46,6 +49,18 @@ class GenerateOptionsErrorsTaskTest extends AbstractContextTest {
unorderedEquals([GenerateOptionsErrorsTask.CONTENT_INPUT_NAME]));
}
+ test_compute_lineInfo() {
+ expect(lineInfo('foo\nbar').getLocation(4).lineNumber, 2);
+ expect(lineInfo('foo\nbar').getLocation(4).columnNumber, 1);
+ expect(lineInfo('foo\r\nbar').getLocation(5).lineNumber, 2);
+ expect(lineInfo('foo\r\nbar').getLocation(5).columnNumber, 1);
+ expect(lineInfo('foo\rbar').getLocation(4).lineNumber, 2);
+ expect(lineInfo('foo\rbar').getLocation(4).columnNumber, 1);
+ expect(lineInfo('foo').getLocation(0).lineNumber, 1);
+ expect(lineInfo('foo').getLocation(0).columnNumber, 1);
+ expect(lineInfo('').getLocation(1).lineNumber, 1);
+ }
+
test_constructor() {
GenerateOptionsErrorsTask task =
new GenerateOptionsErrorsTask(context, source);
« no previous file with comments | « pkg/analyzer/lib/src/task/options.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698