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

Unified Diff: pkg/docgen/test/single_library_test.dart

Issue 18242010: used lookupInScope(name) to find the qualified names in comments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « pkg/docgen/lib/docgen.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/test/single_library_test.dart
diff --git a/pkg/docgen/test/single_library_test.dart b/pkg/docgen/test/single_library_test.dart
index 5edaa3d2cb686c7a4fe0715fcfcf2ce09acdd663..e92c8571ac47bdef85076dd3356732d6cdab7f71 100644
--- a/pkg/docgen/test/single_library_test.dart
+++ b/pkg/docgen/test/single_library_test.dart
@@ -18,7 +18,7 @@ main() {
file.writeAsStringSync('''
library test;
/**
- * Doc comment for class A.
+ * Doc comment for class [A].
*
* Multiline Test
*/
@@ -27,17 +27,17 @@ main() {
*/
class A {
- /**
- * Markdown _test_ for **class** [A]
- */
int _someNumber;
A() {
_someNumber = 12;
}
- void doThis(int a) {
- print(a);
+ /**
+ * Test for linking to parameter [A]
+ */
+ void doThis(int A) {
+ print(A);
}
}
@@ -79,6 +79,30 @@ main() {
var variables = library.variables.values;
expect(variables.every((e) => e is Variable), isTrue);
+ /// Testing fixReference
+ // Testing Doc comment for class [A].
+ var libraryMirror = mirrorSystem.libraries[testLibraryUri];
+ var classMirror = libraryMirror.classes.values.first;
+ var classDocComment = fixReference('A', libraryMirror,
+ classMirror, null).children.first.text;
+ expect(classDocComment == 'test.A', isTrue);
+
+ // Test for linking to parameter [A]
+ var methodMirror = classMirror.methods['doThis'];
+ var methodParameterDocComment = fixReference('A', libraryMirror,
+ classMirror, methodMirror).children.first.text;
+ expect(methodParameterDocComment == 'test.A.doThis#A', isTrue);
+
+ // Testing trying to refer to doThis function
+ var methodDocComment = fixReference('doThis', libraryMirror,
+ classMirror, methodMirror).children.first.text;
+ expect(methodDocComment == 'test.A.doThis', isTrue);
+
+ // Testing something with no reference
+ var libraryDocComment = fixReference('foobar', libraryMirror,
+ classMirror, methodMirror).children.first.text;
+ expect(libraryDocComment == 'foobar', isTrue);
+
file.deleteSync();
}));
});
« no previous file with comments | « pkg/docgen/lib/docgen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698