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); |