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

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

Issue 1347223002: Produce LINE_INFO for HTML files. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/html.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/html_test.dart
diff --git a/pkg/analyzer/test/src/task/html_test.dart b/pkg/analyzer/test/src/task/html_test.dart
index a07dc75135e409317615f1adb71811359393e312..7d8da565b99051ee5aabe6e2c92ca0edfa27ed28 100644
--- a/pkg/analyzer/test/src/task/html_test.dart
+++ b/pkg/analyzer/test/src/task/html_test.dart
@@ -6,6 +6,7 @@ library test.src.task.html_test;
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/task/html.dart';
+import 'package:analyzer/task/general.dart';
import 'package:analyzer/task/html.dart';
import 'package:analyzer/task/model.dart';
import 'package:unittest/unittest.dart';
@@ -294,9 +295,7 @@ class ParseHtmlTaskTest extends AbstractContextTest {
}
test_perform() {
- AnalysisTarget target = newSource(
- '/test.html',
- r'''
+ String code = r'''
<!DOCTYPE html>
<html>
<head>
@@ -306,10 +305,34 @@ class ParseHtmlTaskTest extends AbstractContextTest {
<h1 Test>
</body>
</html>
-''');
+''';
+ AnalysisTarget target = newSource('/test.html', code);
computeResult(target, HTML_DOCUMENT);
expect(task, isParseHtmlTask);
expect(outputs[HTML_DOCUMENT], isNotNull);
expect(outputs[HTML_DOCUMENT_ERRORS], isNotEmpty);
+ // LINE_INFO
+ {
+ LineInfo lineInfo = outputs[LINE_INFO];
+ expect(lineInfo, isNotNull);
+ {
+ int offset = code.indexOf('<!DOCTYPE');
+ LineInfo_Location location = lineInfo.getLocation(offset);
+ expect(location.lineNumber, 1);
+ expect(location.columnNumber, 1);
+ }
+ {
+ int offset = code.indexOf('<html>');
+ LineInfo_Location location = lineInfo.getLocation(offset);
+ expect(location.lineNumber, 2);
+ expect(location.columnNumber, 1);
+ }
+ {
+ int offset = code.indexOf('<title>');
+ LineInfo_Location location = lineInfo.getLocation(offset);
+ expect(location.lineNumber, 4);
+ expect(location.columnNumber, 5);
+ }
+ }
}
}
« no previous file with comments | « pkg/analyzer/lib/src/task/html.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698