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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..60c0109326e4d65081715a60cbce9893518a2b01 |
| --- /dev/null |
| +++ b/pkg/docgen/test/single_library_test.dart |
| @@ -0,0 +1,77 @@ |
| +library single_library_test; |
| + |
| +import 'dart:io'; |
| + |
| +import 'package:unittest/unittest.dart'; |
| + |
| +import '../lib/docgen.dart'; |
| +import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; |
| + |
| +main() { |
| + test('Single file test.', () { |
|
Andrei Mouravski
2013/07/01 19:54:29
I'd recommend having a top level group and put thi
Emily Fortuna
2013/07/01 21:22:41
Disagree. Groups are only useful if you have multi
Andrei Mouravski
2013/07/01 21:43:53
* Disabling tests in status files requires groups.
Emily Fortuna
2013/07/01 21:45:16
I stand corrected.
|
| + var file = new File('test.dart'); |
| + file.writeAsStringSync(''' |
| +library test; |
| +/** |
| + * Doc comment for class A. |
| + * |
| + * Multiline Test |
| + */ |
| +/* |
| + * Normal comment for class A. |
| + */ |
| +class A { |
| + |
| + /** |
| + * Markdown _test_ for **class** [A] |
| + */ |
| + int _someNumber; |
| + |
| + A() { |
| + _someNumber = 12; |
| + } |
| + |
| + void doThis(int a) { |
| + print(a); |
| + } |
| +} |
| + |
| +main() { |
| + A a = new A(); |
| + a.doThis(5); |
| +} |
| + '''); |
| + |
| + parseSdk = false; |
| + includePrivate = true; |
| + includeSdk = false; |
| + getMirrorSystem(['test.dart']).then(expectAsync1((mirrorSystem) { |
|
Emily Fortuna
2013/07/01 21:22:41
You can change this test to not use expectAsync be
|
| + var testLibraryUri = currentDirectory.resolve('test.dart'); |
| + var library = generateLibrary(mirrorSystem.libraries[testLibraryUri]); |
| + expect(library is Library, isTrue); |
| + |
| + var classes = library.classes.values; |
| + expect(classes.every((e) => e is Class), isTrue); |
| + |
| + var classMethods = []; |
| + classes.forEach((e) => classMethods.addAll(e.methods.values)); |
| + expect(classMethods.every((e) => e is Method), isTrue); |
| + |
| + var methodParameters = []; |
| + classMethods.forEach((e) => methodParameters.addAll(e.parameters.values)); |
| + expect(methodParameters.every((e) => e is Parameter), isTrue); |
| + |
| + var functions = library.functions.values; |
| + expect(functions.every((e) => e is Method), isTrue); |
| + |
| + var functionParameters = []; |
| + functions.forEach((e) => functionParameters.addAll(e.parameters.values)); |
| + expect(functionParameters.every((e) => e is Parameter), isTrue); |
| + |
| + var variables = library.variables.values; |
| + expect(variables.every((e) => e is Variable), isTrue); |
| + |
| + file.deleteSync(); |
| + })); |
| + }); |
| +} |