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 30 matching lines...) Expand all Loading... | |
| 41 } | 41 } |
| 42 '''; | 42 '''; |
| 43 | 43 |
| 44 main() { | 44 main() { |
| 45 group('Generate docs for', () { | 45 group('Generate docs for', () { |
| 46 test('one simple file.', () { | 46 test('one simple file.', () { |
| 47 var temporaryDir = Directory.systemTemp.createTempSync('single_library_'); | 47 var temporaryDir = Directory.systemTemp.createTempSync('single_library_'); |
| 48 var fileName = path.join(temporaryDir.path, 'temp.dart'); | 48 var fileName = path.join(temporaryDir.path, 'temp.dart'); |
| 49 var file = new File(fileName); | 49 var file = new File(fileName); |
| 50 file.writeAsStringSync(DART_LIBRARY); | 50 file.writeAsStringSync(DART_LIBRARY); |
| 51 getMirrorSystem([new Uri.file(fileName)]) | 51 |
| 52 .then(expectAsync1((mirrorSystem) { | 52 return getMirrorSystem([new Uri.file(fileName)]) |
|
Alan Knight
2014/02/19 19:00:46
Same here.
| |
| 53 .then((mirrorSystem) { | |
| 53 var testLibraryUri = new Uri.file(path.absolute(fileName), | 54 var testLibraryUri = new Uri.file(path.absolute(fileName), |
| 54 windows: Platform.isWindows); | 55 windows: Platform.isWindows); |
| 55 var library = new Library(mirrorSystem.libraries[testLibraryUri]); | 56 var library = new Library(mirrorSystem.libraries[testLibraryUri]); |
| 56 expect(library is Library, isTrue); | 57 expect(library is Library, isTrue); |
| 57 | 58 |
| 58 var classTypes = library.classes; | 59 var classTypes = library.classes; |
| 59 var classes = []; | 60 var classes = []; |
| 60 classes.addAll(classTypes.values); | 61 classes.addAll(classTypes.values); |
| 61 classes.addAll(library.errors.values); | 62 classes.addAll(library.errors.values); |
| 62 expect(classes.every((e) => e is Class), isTrue); | 63 expect(classes.every((e) => e is Class), isTrue); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 expect(methodParameterDocComment, 'test.A.doThis.A'); | 115 expect(methodParameterDocComment, 'test.A.doThis.A'); |
| 115 | 116 |
| 116 // Testing trying to refer to doThis function | 117 // Testing trying to refer to doThis function |
| 117 var methodDocComment = method.fixReference( | 118 var methodDocComment = method.fixReference( |
| 118 'doThis').children.first.text; | 119 'doThis').children.first.text; |
| 119 expect(methodDocComment, 'test.A.doThis'); | 120 expect(methodDocComment, 'test.A.doThis'); |
| 120 | 121 |
| 121 // Testing something with no reference | 122 // Testing something with no reference |
| 122 var libraryDocComment = method.fixReference('foobar').text; | 123 var libraryDocComment = method.fixReference('foobar').text; |
| 123 expect(libraryDocComment, 'foobar'); | 124 expect(libraryDocComment, 'foobar'); |
| 124 })).whenComplete(() => temporaryDir.deleteSync(recursive: true)); | 125 }).whenComplete(() => temporaryDir.deleteSync(recursive: true)); |
| 125 }); | 126 }); |
| 126 }); | 127 }); |
| 127 } | 128 } |
| OLD | NEW |