Chromium Code Reviews| Index: pkg/docgen/test/single_library_test.dart |
| diff --git a/pkg/docgen/test/single_library_test.dart b/pkg/docgen/test/single_library_test.dart |
| index 6ff153985dd11b6f93fecf6594a9c88860c435a1..a35bad1d7018a2c679b674c5ffe9edf62fc84265 100644 |
| --- a/pkg/docgen/test/single_library_test.dart |
| +++ b/pkg/docgen/test/single_library_test.dart |
| @@ -2,18 +2,17 @@ library single_library_test; |
| import 'dart:io'; |
| +import 'package:path/path.dart' as path; |
| import 'package:unittest/unittest.dart'; |
| import '../lib/docgen.dart'; |
| -import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; |
| main() { |
| group('Generate docs for', () { |
| test('one simple file.', () { |
| - // TODO(janicejl): Instead of creating a new file, should use an in-memory |
| - // file for creating the mirrorSystem. Example of the util function in |
| - // sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart. |
| - // Example of the test is in file mirrors_lookup_test.dart |
| + var current = Directory.current; |
| + var temporaryDir = new Directory('single_library').createTempSync(); |
| + Directory.current = temporaryDir; |
|
Emily Fortuna
2013/07/22 23:09:10
how about instead of setting your current director
janicejl
2013/07/22 23:27:45
Done.
|
| var file = new File('test.dart'); |
| file.writeAsStringSync(''' |
| library test; |
| @@ -47,11 +46,12 @@ main() { |
| } |
| '''); |
| - getMirrorSystem(['test.dart'],'', parseSdk: false) |
| + getMirrorSystem(['test.dart']) |
| .then(expectAsync1((mirrorSystem) { |
| - var testLibraryUri = currentDirectory.resolve('test.dart'); |
| + var testLibraryUri = new Uri(scheme: 'file', |
| + path: path.absolute('test.dart')); |
| var library = generateLibrary(mirrorSystem.libraries[testLibraryUri], |
| - includePrivate: true); |
| + includePrivate: false); |
| expect(library is Library, isTrue); |
| var classTypes = library.classes.values; |
| @@ -115,7 +115,8 @@ main() { |
| classMirror, methodMirror).children.first.text; |
| expect(libraryDocComment == 'foobar', isTrue); |
| - file.deleteSync(); |
| + Directory.current = current; |
| + temporaryDir.deleteSync(recursive: true); |
| })); |
| }); |
| }); |