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

Side by Side Diff: pkg/docgen/test/multi_library_test.dart

Issue 135653009: Fix package docnames for select return types, and some more docgen refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/docgen/lib/docgen.dart ('k') | pkg/docgen/test/single_library_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library single_library_test; 1 library single_library_test;
2 2
3 import 'dart:io'; 3 import 'dart:io';
4 4
5 import 'package:path/path.dart' as path; 5 import 'package:path/path.dart' as path;
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 7
8 import '../lib/docgen.dart'; 8 import '../lib/docgen.dart';
9 9
10 const String DART_LIBRARY_1 = ''' 10 const String DART_LIBRARY_1 = '''
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Testing Doc comment for class [B]. 121 // Testing Doc comment for class [B].
122 var libraryMirror = mirrorSystem.libraries[testLibraryUri]; 122 var libraryMirror = mirrorSystem.libraries[testLibraryUri];
123 var classDocComment = library.fixReference('B').children.first.text; 123 var classDocComment = library.fixReference('B').children.first.text;
124 expect(classDocComment, 'testLib.B'); 124 expect(classDocComment, 'testLib.B');
125 125
126 // Test for linking to parameter [c] 126 // Test for linking to parameter [c]
127 var importedLib = libraryMirror.libraryDependencies.firstWhere( 127 var importedLib = libraryMirror.libraryDependencies.firstWhere(
128 (dep) => dep.isImport).targetLibrary; 128 (dep) => dep.isImport).targetLibrary;
129 var aClassMirror = importedLib.classes.values.first; 129 var aClassMirror = importedLib.classes.values.first;
130 expect(aClassMirror.qualifiedName, 'testLib2.foo.B'); 130 expect(aClassMirror.qualifiedName, 'testLib2.foo.B');
131 var exportedClass = getDocgenObject(aClassMirror, library); 131 var exportedClass = Indexable.getDocgenObject(aClassMirror, library);
132 expect(exportedClass is Class, isTrue); 132 expect(exportedClass is Class, isTrue);
133 133
134 134
135 var method = exportedClass.methods['doThis']; 135 var method = exportedClass.methods['doThis'];
136 expect(method is Method, isTrue); 136 expect(method is Method, isTrue);
137 var methodParameterDocComment = method.fixReference( 137 var methodParameterDocComment = method.fixReference(
138 'c').children.first.text; 138 'c').children.first.text;
139 expect(methodParameterDocComment, 'testLib.B.doThis.c'); 139 expect(methodParameterDocComment, 'testLib.B.doThis.c');
140 140
141 141
142 expect(method.fixReference('A').children.first.text, 'testLib.A'); 142 expect(method.fixReference('A').children.first.text, 'testLib.A');
143 // Testing trying to refer to doThis function 143 // Testing trying to refer to doThis function
144 expect(method.fixReference('doThis').children.first.text, 144 expect(method.fixReference('doThis').children.first.text,
145 'testLib.B.doThis'); 145 'testLib.B.doThis');
146 146
147 // Testing trying to refer to doThis function 147 // Testing trying to refer to doThis function
148 expect(method.fixReference('doElse').children.first.text, 148 expect(method.fixReference('doElse').children.first.text,
149 'testLib.B.doElse'); 149 'testLib.B.doElse');
150 150
151 151
152 // Test a third library referencing another exported library in a 152 // Test a third library referencing another exported library in a
153 // separate file. 153 // separate file.
154 importedLib = libraryMirror.libraryDependencies.firstWhere( 154 importedLib = libraryMirror.libraryDependencies.firstWhere(
155 (dep) => dep.isImport && dep.targetLibrary.qualifiedName == 155 (dep) => dep.isImport && dep.targetLibrary.qualifiedName ==
156 'testLib.bar').targetLibrary; 156 'testLib.bar').targetLibrary;
157 aClassMirror = importedLib.classes.values.first; 157 aClassMirror = importedLib.classes.values.first;
158 expect(aClassMirror.qualifiedName, 'testLib.bar.C'); 158 expect(aClassMirror.qualifiedName, 'testLib.bar.C');
159 exportedClass = getDocgenObject(aClassMirror, library); 159 exportedClass = Indexable.getDocgenObject(aClassMirror, library);
160 expect(exportedClass is Class, isTrue); 160 expect(exportedClass is Class, isTrue);
161 expect(exportedClass.docName, 'testLib.C'); 161 expect(exportedClass.docName, 'testLib.C');
162 162
163 methodParameterDocComment = exportedClass.fixReference( 163 methodParameterDocComment = exportedClass.fixReference(
164 'B').children.first.text; 164 'B').children.first.text;
165 expect(methodParameterDocComment, 'testLib.B'); 165 expect(methodParameterDocComment, 'testLib.B');
166 166
167 methodParameterDocComment = exportedClass.fixReference( 167 methodParameterDocComment = exportedClass.fixReference(
168 'testFunc').children.first.text; 168 'testFunc').children.first.text;
169 expect(methodParameterDocComment, 'testLib.testFunc'); 169 expect(methodParameterDocComment, 'testLib.testFunc');
170 170
171 })).whenComplete(() => TEMP_DIRNAME.deleteSync(recursive: true)); 171 })).whenComplete(() => TEMP_DIRNAME.deleteSync(recursive: true));
172 }); 172 });
173 }); 173 });
174 } 174 }
OLDNEW
« no previous file with comments | « pkg/docgen/lib/docgen.dart ('k') | pkg/docgen/test/single_library_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698