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

Unified Diff: compiler/javatests/com/google/dart/compiler/parser/CommentTest.java

Issue 8769044: Added code to associate a dart doc comment with a dart declaration node. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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: compiler/javatests/com/google/dart/compiler/parser/CommentTest.java
===================================================================
--- compiler/javatests/com/google/dart/compiler/parser/CommentTest.java (revision 2064)
+++ compiler/javatests/com/google/dart/compiler/parser/CommentTest.java (working copy)
@@ -7,6 +7,9 @@
import com.google.dart.compiler.CompilerTestCase;
import com.google.dart.compiler.DartCompilerListener;
import com.google.dart.compiler.Source;
+import com.google.dart.compiler.ast.DartDeclaration;
+import com.google.dart.compiler.ast.DartNode;
+import com.google.dart.compiler.ast.DartUnit;
import java.util.ArrayList;
import java.util.List;
@@ -77,6 +80,12 @@
compareComments(EXPECTED002);
}
+ public void test003() {
+ DartUnit unit = parseUnit("Comments2.dart");
+ assertDeclComments(unit, "firstMethod", "/** Comments are good. */");
+ assertDeclComments(unit, "secondMethod", null);
+ }
+
@Override
protected ParserContext makeParserContext(Source src, String sourceCode,
DartCompilerListener listener) {
@@ -102,4 +111,20 @@
assertEquals(expected[i], comments.get(i));
}
}
+
+ private void assertDeclComments(DartUnit unit, String name, String comments) {
+ for (DartNode node : unit.getTopLevelNodes()) {
+ if (node instanceof DartDeclaration && node.getSymbol() != null
+ && name.equals(node.getSymbol().getOriginalSymbolName())) {
+ DartDeclaration<?> decl = (DartDeclaration<?>)node;
+ String nodeComments = null;
+
+ if (decl.getDartDoc() != null) {
+ nodeComments = decl.getDartDoc().toSource();
+ }
+
+ assertEquals(comments, nodeComments);
+ }
+ }
+ }
}

Powered by Google App Engine
This is Rietveld 408576698