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

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

Issue 2168833003: Support references to operators in doc comments (issue 26929) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/parser_test.dart
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index f6266355e92199a76d58aaf7836f70e951204c5f..e74309d6d31aebada6826a5e0b61f9e19f8f06ea 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -6281,6 +6281,66 @@ void''');
expect(identifier.offset, 9);
}
+ void test_parseCommentReference_operator_withKeyword_notPrefixed() {
+ CommentReference reference =
+ parse("parseCommentReference", <Object>["operator ==", 5], "");
+ SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ reference.identifier);
+ expect(identifier.token, isNotNull);
+ expect(identifier.name, "==");
+ expect(identifier.offset, 14);
+ }
+
+ void test_parseCommentReference_operator_withKeyword_prefixed() {
+ CommentReference reference =
+ parse("parseCommentReference", <Object>["Object.operator==", 7], "");
+ PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf(
+ (obj) => obj is PrefixedIdentifier,
+ PrefixedIdentifier,
+ reference.identifier);
+ SimpleIdentifier prefix = prefixedIdentifier.prefix;
+ expect(prefix.token, isNotNull);
+ expect(prefix.name, "Object");
+ expect(prefix.offset, 7);
+ expect(prefixedIdentifier.period, isNotNull);
+ SimpleIdentifier identifier = prefixedIdentifier.identifier;
+ expect(identifier.token, isNotNull);
+ expect(identifier.name, "==");
+ expect(identifier.offset, 22);
+ }
+
+ void test_parseCommentReference_operator_withoutKeyword_notPrefixed() {
+ CommentReference reference =
+ parse("parseCommentReference", <Object>["==", 5], "");
+ SimpleIdentifier identifier = EngineTestCase.assertInstanceOf(
+ (obj) => obj is SimpleIdentifier,
+ SimpleIdentifier,
+ reference.identifier);
+ expect(identifier.token, isNotNull);
+ expect(identifier.name, "==");
+ expect(identifier.offset, 5);
+ }
+
+ void test_parseCommentReference_operator_withoutKeyword_prefixed() {
+ CommentReference reference =
+ parse("parseCommentReference", <Object>["Object.==", 7], "");
+ PrefixedIdentifier prefixedIdentifier = EngineTestCase.assertInstanceOf(
+ (obj) => obj is PrefixedIdentifier,
+ PrefixedIdentifier,
+ reference.identifier);
+ SimpleIdentifier prefix = prefixedIdentifier.prefix;
+ expect(prefix.token, isNotNull);
+ expect(prefix.name, "Object");
+ expect(prefix.offset, 7);
+ expect(prefixedIdentifier.period, isNotNull);
+ SimpleIdentifier identifier = prefixedIdentifier.identifier;
+ expect(identifier.token, isNotNull);
+ expect(identifier.name, "==");
+ expect(identifier.offset, 14);
+ }
+
void test_parseCommentReference_prefixed() {
CommentReference reference =
parse("parseCommentReference", <Object>["a.b", 7], "");

Powered by Google App Engine
This is Rietveld 408576698