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

Unified Diff: pkg/analyzer/test/generated/incremental_resolver_test.dart

Issue 758383003: Incremental resolution of updated DartDoc comments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
Index: pkg/analyzer/test/generated/incremental_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/incremental_resolver_test.dart b/pkg/analyzer/test/generated/incremental_resolver_test.dart
index 6398504a03d3719287dd91103045e360c18d40f0..7c3a3638dc93754c5be588f4943ef81aade08527 100644
--- a/pkg/analyzer/test/generated/incremental_resolver_test.dart
+++ b/pkg/analyzer/test/generated/incremental_resolver_test.dart
@@ -2099,9 +2099,7 @@ class B {
// do incremental resolution
IncrementalResolver resolver = new IncrementalResolver(
typeProvider,
- library,
unit.element,
- source,
edit.offset,
edit.length,
edit.replacement.length);
@@ -2178,6 +2176,134 @@ class PoorMansIncrementalResolutionTest extends ResolverTestCase {
_resetWithIncremental(true);
}
+ void test_dartDoc_beforeField() {
+ _resolveUnit(r'''
+class A {
+ /**
+ * A field [field] of type [int] in class [A].
+ */
+ int field;
+}
+''');
+ _updateAndValidate(r'''
+class A {
+ /**
+ * A field [field] of the type [int] in the class [A].
+ * Updated, with a reference to the [String] type.
+ */
+ int field;
+}
+''');
+ }
+
+ void test_dartDoc_clumsy_addReference() {
+ _resolveUnit(r'''
+/**
+ * aaa bbbb
+ */
+main() {
+}
+''');
+ _updateAndValidate(r'''
+/**
+ * aaa [main] bbbb
+ */
+main() {
+}
+''');
+ }
+
+ void test_dartDoc_clumsy_removeReference() {
+ _resolveUnit(r'''
+/**
+ * aaa [main] bbbb
+ */
+main() {
+}
+''');
+ _updateAndValidate(r'''
+/**
+ * aaa bbbb
+ */
+main() {
+}
+''');
+ }
+
+ void test_dartDoc_clumsy_updateText() {
+ _resolveUnit(r'''
+/**
+ * A function [main] with a parameter [p] of type [int].
+ */
+main(int p) {
+}
+/**
+ * Other comment.
+ */
+foo() {}
+''');
+ _updateAndValidate(r'''
+/**
+ * A function [main] with a parameter [p] of type [int].
+ * Updated.
+ */
+main(int p) {
+}
+/**
+ * Other comment.
+ */
+foo() {}
+''');
+ }
+
+ void test_dartDoc_clumsy_updateText_beforeKeywordToken() {
+ _resolveUnit(r'''
+/**
+ * A comment with the [int] type reference.
+ */
+class A {}
+''');
+ _updateAndValidate(r'''
+/**
+ * A comment with the [int] type reference.
+ * Plus reference to [A] itself.
+ */
+class A {}
+''');
+ }
+
+ void test_dartDoc_elegant_addReference() {
+ _resolveUnit(r'''
+/// aaa bbb
+main() {
+ return 1;
+}
+''');
+ _updateAndValidate(r'''
+/// aaa [main] bbb
+/// ccc [int] ddd
+main() {
+ return 2;
+}
+''');
+ }
+
+ void test_dartDoc_elegant_removeReference() {
+ _resolveUnit(r'''
+/// aaa [main] bbb
+/// ccc [int] ddd
+main() {
+ return 1;
+}
+''');
+ _updateAndValidate(r'''
+/// aaa bbb
+main() {
+ return 2;
+}
+''');
+ }
+
void test_false_topLevelFunction_name() {
_resolveUnit(r'''
a() {}
@@ -2650,6 +2776,21 @@ f3() {
// print('$incrToken @ ${incrToken.offset}');
// print('$fullToken @ ${fullToken.offset}');
_assertEqualToken(incrToken, fullToken);
+ // comments
+ {
+ Token incrComment = incrToken.precedingComments;
+ Token fullComment = fullToken.precedingComments;
+ while (true) {
+ if (fullComment == null) {
+ expect(incrComment, isNull);
+ break;
+ }
+ _assertEqualToken(incrComment, fullComment);
+ incrComment = incrComment.next;
+ fullComment = fullComment.next;
+ }
+ }
+ // next tokens
incrToken = incrToken.next;
fullToken = fullToken.next;
}
« pkg/analyzer/lib/src/generated/scanner.dart ('K') | « pkg/analyzer/lib/src/generated/scanner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698