| Index: pkg/docgen/test/async_await_test.dart
|
| diff --git a/pkg/docgen/test/single_library_test.dart b/pkg/docgen/test/async_await_test.dart
|
| similarity index 81%
|
| copy from pkg/docgen/test/single_library_test.dart
|
| copy to pkg/docgen/test/async_await_test.dart
|
| index 31f3a5ea8a899cedd3bb9d5e53463f10d5fa6e87..e1294556c4909564db7fad5b342ef9d8a4dc8a42 100644
|
| --- a/pkg/docgen/test/single_library_test.dart
|
| +++ b/pkg/docgen/test/async_await_test.dart
|
| @@ -2,7 +2,7 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -library single_library_test;
|
| +library async_await_test;
|
|
|
| import 'dart:io';
|
|
|
| @@ -23,30 +23,47 @@ const String DART_LIBRARY = '''
|
| * Normal comment for class A.
|
| */
|
| class A {
|
| + m1() sync* {
|
| + yield 0;
|
| + }
|
|
|
| - int _someNumber;
|
| -
|
| - A() {
|
| - _someNumber = 12;
|
| + m2() async {
|
| + await 0;
|
| + await for (var e in m1()) {}
|
| }
|
|
|
| - /**
|
| - * Test for linking to parameter [A]
|
| - */
|
| - void doThis(int A) {
|
| - print(A);
|
| + m3() async* {
|
| + yield* m1();
|
| }
|
| }
|
|
|
| + m1() sync* {
|
| + yield 0;
|
| + }
|
| +
|
| + m2() async {
|
| + await 0;
|
| + await for (var e in m1()) {}
|
| + }
|
| +
|
| + m3() async* {
|
| + yield* m1();
|
| + }
|
| +
|
| main() {
|
| + m1();
|
| + m2();
|
| + m3();
|
| A a = new A();
|
| - a.doThis(5);
|
| + a.m1();
|
| + a.m2();
|
| + a.m3();
|
| }
|
| ''';
|
|
|
| main() {
|
| group('Generate docs for', () {
|
| - test('one simple file.', () {
|
| + test('file with async/await.', () {
|
| var temporaryDir = Directory.systemTemp.createTempSync('single_library_');
|
| var fileName = path.join(temporaryDir.path, 'temp.dart');
|
| var file = new File(fileName);
|
| @@ -72,7 +89,8 @@ main() {
|
| classMethodTypes.add(e.methods);
|
| classMethodTypes.add(e.inheritedMethods);
|
| });
|
| - expect(classMethodTypes.every((e) => e is Map<String, Method>), isTrue);
|
| + expect(classMethodTypes.every((e) => e is Map<String, Method>),
|
| + isTrue);
|
|
|
| var classMethods = [];
|
| classMethodTypes.forEach((e) {
|
| @@ -112,19 +130,20 @@ main() {
|
|
|
| // Test for linking to parameter [A]
|
| var method = getDocgenObject(
|
| - classMirror.declarations[dart2js_util.symbolOf('doThis')]);
|
| - var methodParameterDocComment = method.fixReference(
|
| - 'A').children.first.text;
|
| - expect(methodParameterDocComment, 'test.A.doThis.A');
|
| + classMirror.declarations[dart2js_util.symbolOf('m1')]);
|
|
|
| - // Testing trying to refer to doThis function
|
| + // Testing trying to refer to m1 method
|
| var methodDocComment = method.fixReference(
|
| - 'doThis').children.first.text;
|
| - expect(methodDocComment, 'test.A.doThis');
|
| + 'm1').children.first.text;
|
| + expect(methodDocComment, 'test.A.m1');
|
|
|
| // Testing something with no reference
|
| var libraryDocComment = method.fixReference('foobar').text;
|
| expect(libraryDocComment, 'foobar');
|
| +
|
| + // Testing trying to refer to m1 function
|
| + libraryDocComment = library.fixReference('m1').children.first.text;
|
| + expect(libraryDocComment, 'test.m1');
|
| }).whenComplete(() => temporaryDir.deleteSync(recursive: true));
|
| });
|
| });
|
|
|