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

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

Issue 209563002: pkg/docgen: the big refactor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: silly Created 6 years, 9 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/test/multi_library_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library single_library_test; 5 library single_library_test;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:path/path.dart' as path; 9 import 'package:path/path.dart' as path;
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 '''; 46 ''';
47 47
48 main() { 48 main() {
49 group('Generate docs for', () { 49 group('Generate docs for', () {
50 test('one simple file.', () { 50 test('one simple file.', () {
51 var temporaryDir = Directory.systemTemp.createTempSync('single_library_'); 51 var temporaryDir = Directory.systemTemp.createTempSync('single_library_');
52 var fileName = path.join(temporaryDir.path, 'temp.dart'); 52 var fileName = path.join(temporaryDir.path, 'temp.dart');
53 var file = new File(fileName); 53 var file = new File(fileName);
54 file.writeAsStringSync(DART_LIBRARY); 54 file.writeAsStringSync(DART_LIBRARY);
55 55
56 return getMirrorSystem([new Uri.file(fileName)]) 56 return getMirrorSystem([new Uri.file(fileName)], false)
57 .then((mirrorSystem) { 57 .then((mirrorSystem) {
58 var testLibraryUri = new Uri.file(path.absolute(fileName), 58 var testLibraryUri = new Uri.file(path.absolute(fileName),
59 windows: Platform.isWindows); 59 windows: Platform.isWindows);
60 var library = new Library(mirrorSystem.libraries[testLibraryUri]); 60 var library = new Library(mirrorSystem.libraries[testLibraryUri]);
61 expect(library is Library, isTrue); 61 expect(library is Library, isTrue);
62 62
63 var classTypes = library.classes; 63 var classTypes = library.classes;
64 var classes = []; 64 var classes = [];
65 classes.addAll(classTypes.values); 65 classes.addAll(classTypes.values);
66 classes.addAll(library.errors.values); 66 classes.addAll(library.errors.values);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 /// Testing fixReference 106 /// Testing fixReference
107 // Testing Doc comment for class [A]. 107 // Testing Doc comment for class [A].
108 var libraryMirror = mirrorSystem.libraries[testLibraryUri]; 108 var libraryMirror = mirrorSystem.libraries[testLibraryUri];
109 var classMirror = 109 var classMirror =
110 dart2js_util.classesOf(libraryMirror.declarations).first; 110 dart2js_util.classesOf(libraryMirror.declarations).first;
111 var classDocComment = library.fixReference('A').children.first.text; 111 var classDocComment = library.fixReference('A').children.first.text;
112 expect(classDocComment, 'test.A'); 112 expect(classDocComment, 'test.A');
113 113
114 // Test for linking to parameter [A] 114 // Test for linking to parameter [A]
115 var method = Indexable.getDocgenObject( 115 var method = getDocgenObject(
116 classMirror.declarations[dart2js_util.symbolOf('doThis')]); 116 classMirror.declarations[dart2js_util.symbolOf('doThis')]);
117 var methodParameterDocComment = method.fixReference( 117 var methodParameterDocComment = method.fixReference(
118 'A').children.first.text; 118 'A').children.first.text;
119 expect(methodParameterDocComment, 'test.A.doThis.A'); 119 expect(methodParameterDocComment, 'test.A.doThis.A');
120 120
121 // Testing trying to refer to doThis function 121 // Testing trying to refer to doThis function
122 var methodDocComment = method.fixReference( 122 var methodDocComment = method.fixReference(
123 'doThis').children.first.text; 123 'doThis').children.first.text;
124 expect(methodDocComment, 'test.A.doThis'); 124 expect(methodDocComment, 'test.A.doThis');
125 125
126 // Testing something with no reference 126 // Testing something with no reference
127 var libraryDocComment = method.fixReference('foobar').text; 127 var libraryDocComment = method.fixReference('foobar').text;
128 expect(libraryDocComment, 'foobar'); 128 expect(libraryDocComment, 'foobar');
129 }).whenComplete(() => temporaryDir.deleteSync(recursive: true)); 129 }).whenComplete(() => temporaryDir.deleteSync(recursive: true));
130 }); 130 });
131 }); 131 });
132 } 132 }
OLDNEW
« no previous file with comments | « pkg/docgen/test/multi_library_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698