Chromium Code Reviews| 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 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util. dart' | 9 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util. dart' |
| 10 as dart2js_util; | 10 as dart2js_util; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 library testLib.bar; | 84 library testLib.bar; |
| 85 import 'temp.dart'; | 85 import 'temp.dart'; |
| 86 | 86 |
| 87 /* | 87 /* |
| 88 * Normal comment for class C. | 88 * Normal comment for class C. |
| 89 */ | 89 */ |
| 90 class C { | 90 class C { |
| 91 } | 91 } |
| 92 '''; | 92 '''; |
| 93 | 93 |
| 94 Directory TEMP_DIRNAME; | 94 Directory _tempDir; |
|
Alan Knight
2014/02/19 19:00:46
What's the point of making things private in a tes
| |
| 95 | 95 |
| 96 List writeLibFiles() { | 96 List<Uri> _writeLibFiles() { |
| 97 TEMP_DIRNAME = Directory.systemTemp.createTempSync('single_library_'); | 97 _tempDir = Directory.systemTemp.createTempSync('single_library_'); |
| 98 var fileName = path.join(TEMP_DIRNAME.path, 'temp.dart'); | 98 var fileName = path.join(_tempDir.path, 'temp.dart'); |
| 99 var file = new File(fileName); | 99 var file = new File(fileName); |
| 100 file.writeAsStringSync(DART_LIBRARY_1); | 100 file.writeAsStringSync(DART_LIBRARY_1); |
| 101 | 101 |
| 102 var fileName2 = path.join(TEMP_DIRNAME.path, 'temp2.dart'); | 102 var fileName2 = path.join(_tempDir.path, 'temp2.dart'); |
| 103 file = new File(fileName2); | 103 file = new File(fileName2); |
| 104 file.writeAsStringSync(DART_LIBRARY_2); | 104 file.writeAsStringSync(DART_LIBRARY_2); |
| 105 | 105 |
| 106 var fileName3 = path.join(TEMP_DIRNAME.path, 'temp3.dart'); | 106 var fileName3 = path.join(_tempDir.path, 'temp3.dart'); |
| 107 file = new File(fileName3); | 107 file = new File(fileName3); |
| 108 file.writeAsStringSync(DART_LIBRARY_3); | 108 file.writeAsStringSync(DART_LIBRARY_3); |
| 109 return [new Uri.file(fileName, windows: Platform.isWindows), | 109 return [new Uri.file(fileName, windows: Platform.isWindows), |
| 110 new Uri.file(fileName2, windows: Platform.isWindows), | 110 new Uri.file(fileName2, windows: Platform.isWindows), |
| 111 new Uri.file(fileName3, windows: Platform.isWindows)]; | 111 new Uri.file(fileName3, windows: Platform.isWindows)]; |
| 112 } | 112 } |
| 113 | 113 |
| 114 main() { | 114 void main() { |
| 115 group('Generate docs for', () { | 115 group('Generate docs for', () { |
| 116 test('multiple libraries.', () { | 116 test('multiple libraries.', () { |
| 117 var files = writeLibFiles(); | 117 var files = _writeLibFiles(); |
| 118 getMirrorSystem(files) | 118 return getMirrorSystem(files) |
|
Alan Knight
2014/02/19 19:00:46
Is the return value actually used? An explicit ret
| |
| 119 .then(expectAsync1((mirrorSystem) { | 119 .then((mirrorSystem) { |
| 120 var testLibraryUri = files[0]; | 120 var testLibraryUri = files[0]; |
| 121 var library = new Library(mirrorSystem.libraries[testLibraryUri]); | 121 var library = new Library(mirrorSystem.libraries[testLibraryUri]); |
| 122 | 122 |
| 123 /// Testing fixReference | 123 /// Testing fixReference |
| 124 // Testing Doc comment for class [B]. | 124 // Testing Doc comment for class [B]. |
| 125 var libraryMirror = mirrorSystem.libraries[testLibraryUri]; | 125 var libraryMirror = mirrorSystem.libraries[testLibraryUri]; |
| 126 var classDocComment = library.fixReference('B').children.first.text; | 126 var classDocComment = library.fixReference('B').children.first.text; |
| 127 expect(classDocComment, 'testLib.B'); | 127 expect(classDocComment, 'testLib.B'); |
| 128 | 128 |
| 129 // Test for linking to parameter [c] | 129 // Test for linking to parameter [c] |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 expect(methodParameterDocComment, 'testLib.B'); | 172 expect(methodParameterDocComment, 'testLib.B'); |
| 173 | 173 |
| 174 methodParameterDocComment = exportedClass.fixReference( | 174 methodParameterDocComment = exportedClass.fixReference( |
| 175 'testFunc').children.first.text; | 175 'testFunc').children.first.text; |
| 176 expect(methodParameterDocComment, 'testLib.testFunc'); | 176 expect(methodParameterDocComment, 'testLib.testFunc'); |
| 177 | 177 |
| 178 })).whenComplete(() => TEMP_DIRNAME.deleteSync(recursive: true)); | 178 })).whenComplete(() => TEMP_DIRNAME.deleteSync(recursive: true)); |
| 179 }); | 179 }); |
| 180 }); | 180 }); |
| 181 } | 181 } |
| OLD | NEW |