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

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

Issue 19695013: "Reverting 25378" (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/docgen/lib/docgen.dart ('k') | pkg/pkg.status » ('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;
6 import 'package:unittest/unittest.dart'; 5 import 'package:unittest/unittest.dart';
7 6
8 import '../lib/docgen.dart'; 7 import '../lib/docgen.dart';
8 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
9 9
10 main() { 10 main() {
11 group('Generate docs for', () { 11 group('Generate docs for', () {
12 test('one simple file.', () { 12 test('one simple file.', () {
13 var temporaryDir = new Directory('single_library').createTempSync(); 13 // TODO(janicejl): Instead of creating a new file, should use an in-memory
14 var fileName = path.join(temporaryDir.path, 'temp.dart'); 14 // file for creating the mirrorSystem. Example of the util function in
15 var file = new File(fileName); 15 // sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart.
16 // Example of the test is in file mirrors_lookup_test.dart
17 var file = new File('test.dart');
16 file.writeAsStringSync(''' 18 file.writeAsStringSync('''
17 library test; 19 library test;
18 /** 20 /**
19 * Doc comment for class [A]. 21 * Doc comment for class [A].
20 * 22 *
21 * Multiline Test 23 * Multiline Test
22 */ 24 */
23 /* 25 /*
24 * Normal comment for class A. 26 * Normal comment for class A.
25 */ 27 */
(...skipping 12 matching lines...) Expand all
38 print(A); 40 print(A);
39 } 41 }
40 } 42 }
41 43
42 main() { 44 main() {
43 A a = new A(); 45 A a = new A();
44 a.doThis(5); 46 a.doThis(5);
45 } 47 }
46 '''); 48 ''');
47 49
48 getMirrorSystem([fileName]) 50 getMirrorSystem(['test.dart'],'', parseSdk: false)
49 .then(expectAsync1((mirrorSystem) { 51 .then(expectAsync1((mirrorSystem) {
50 var testLibraryUri = new Uri(scheme: 'file', 52 var testLibraryUri = currentDirectory.resolve('test.dart');
51 path: path.absolute(fileName));
52 var library = generateLibrary(mirrorSystem.libraries[testLibraryUri], 53 var library = generateLibrary(mirrorSystem.libraries[testLibraryUri],
53 includePrivate: false); 54 includePrivate: true);
54 expect(library is Library, isTrue); 55 expect(library is Library, isTrue);
55 56
56 var classTypes = library.classes.values; 57 var classTypes = library.classes.values;
57 expect(classTypes.every((e) => e is Map), isTrue); 58 expect(classTypes.every((e) => e is Map), isTrue);
58 59
59 var classes = []; 60 var classes = [];
60 classTypes.forEach((e) => classes.addAll(e.values)); 61 classTypes.forEach((e) => classes.addAll(e.values));
61 expect(classes.every((e) => e is Class), isTrue); 62 expect(classes.every((e) => e is Class), isTrue);
62 63
63 var classMethodTypes = []; 64 var classMethodTypes = [];
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // Testing trying to refer to doThis function 108 // Testing trying to refer to doThis function
108 var methodDocComment = fixReference('doThis', libraryMirror, 109 var methodDocComment = fixReference('doThis', libraryMirror,
109 classMirror, methodMirror).children.first.text; 110 classMirror, methodMirror).children.first.text;
110 expect(methodDocComment == 'test.A.doThis', isTrue); 111 expect(methodDocComment == 'test.A.doThis', isTrue);
111 112
112 // Testing something with no reference 113 // Testing something with no reference
113 var libraryDocComment = fixReference('foobar', libraryMirror, 114 var libraryDocComment = fixReference('foobar', libraryMirror,
114 classMirror, methodMirror).children.first.text; 115 classMirror, methodMirror).children.first.text;
115 expect(libraryDocComment == 'foobar', isTrue); 116 expect(libraryDocComment == 'foobar', isTrue);
116 117
117 temporaryDir.deleteSync(recursive: true); 118 file.deleteSync();
118 })); 119 }));
119 }); 120 });
120 }); 121 });
121 } 122 }
OLDNEW
« no previous file with comments | « pkg/docgen/lib/docgen.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698