OLD | NEW |
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 = ''' | 10 const String DART_LIBRARY = ''' |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 '''; | 40 '''; |
41 | 41 |
42 main() { | 42 main() { |
43 group('Generate docs for', () { | 43 group('Generate docs for', () { |
44 test('one simple file.', () { | 44 test('one simple file.', () { |
45 var temporaryDir = Directory.systemTemp.createTempSync('single_library_'); | 45 var temporaryDir = Directory.systemTemp.createTempSync('single_library_'); |
46 var fileName = path.join(temporaryDir.path, 'temp.dart'); | 46 var fileName = path.join(temporaryDir.path, 'temp.dart'); |
47 var file = new File(fileName); | 47 var file = new File(fileName); |
48 file.writeAsStringSync(DART_LIBRARY); | 48 file.writeAsStringSync(DART_LIBRARY); |
49 getMirrorSystem([fileName]) | 49 getMirrorSystem([new Uri.file(fileName)]) |
50 .then(expectAsync1((mirrorSystem) { | 50 .then(expectAsync1((mirrorSystem) { |
51 var testLibraryUri = new Uri(scheme: 'file', | 51 var testLibraryUri = new Uri(scheme: 'file', |
52 path: path.absolute(fileName)); | 52 path: path.absolute(fileName)); |
53 var library = generateLibrary(mirrorSystem.libraries[testLibraryUri]); | 53 var library = generateLibrary(mirrorSystem.libraries[testLibraryUri]); |
54 expect(library is Library, isTrue); | 54 expect(library is Library, isTrue); |
55 | 55 |
56 var classTypes = library.classes; | 56 var classTypes = library.classes; |
57 expect(classTypes is ClassGroup, isTrue); | 57 expect(classTypes is ClassGroup, isTrue); |
58 | 58 |
59 var classes = []; | 59 var classes = []; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 expect(methodDocComment == 'test.A.doThis', isTrue); | 127 expect(methodDocComment == 'test.A.doThis', isTrue); |
128 | 128 |
129 // Testing something with no reference | 129 // Testing something with no reference |
130 var libraryDocComment = fixReference('foobar', libraryMirror, | 130 var libraryDocComment = fixReference('foobar', libraryMirror, |
131 classMirror, methodMirror).text; | 131 classMirror, methodMirror).text; |
132 expect(libraryDocComment == 'foobar', isTrue); | 132 expect(libraryDocComment == 'foobar', isTrue); |
133 })).whenComplete(() => temporaryDir.deleteSync(recursive: true)); | 133 })).whenComplete(() => temporaryDir.deleteSync(recursive: true)); |
134 }); | 134 }); |
135 }); | 135 }); |
136 } | 136 } |
OLD | NEW |