diff --git a/appveyor.yml b/appveyor.yml index 9db04077b2..3412652f6d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,12 @@ install: - set PATH=%PATH%;%APPDATA%\Pub\Cache\bin - pub get +# this doesn't seem to be working build: off +branches: + only: + - disable_builds_for_now + test_script: - pub run grinder buildbot diff --git a/lib/src/html_generator.dart b/lib/src/html_generator.dart index 4387f99cea..8b37412b7e 100644 --- a/lib/src/html_generator.dart +++ b/lib/src/html_generator.dart @@ -251,7 +251,7 @@ class HtmlGeneratorInstance { void generateLibrary(Package package, Library lib) { print('generating docs for library ${lib.name} from ${lib.path}...'); - if (!lib.hasDocumentation) { + if (!lib.isAnonymous && !lib.hasDocumentation) { print(" warning: library '${lib.name}' has no documentation"); } diff --git a/lib/src/model.dart b/lib/src/model.dart index ff9c6dbec4..41a6866a93 100644 --- a/lib/src/model.dart +++ b/lib/src/model.dart @@ -525,6 +525,8 @@ class Library extends ModelElement { e.nameOffset == element.nameOffset; } + bool get isAnonymous => element.name == null || element.name.isEmpty; + String get name { if (_name != null) return _name; diff --git a/test/model_test.dart b/test/model_test.dart index 991e1e6d20..cb88835062 100644 --- a/test/model_test.dart +++ b/test/model_test.dart @@ -78,6 +78,16 @@ void main() { expect(sdkAsPackage.documentation, startsWith('Welcome to the Dart API reference doc')); }); + + test('has anonymous libraries', () { + expect( + package.libraries.where((lib) => lib.name == 'anonymous_library'), + hasLength(1)); + expect( + package.libraries + .where((lib) => lib.name == 'another_anonymous_lib'), + hasLength(1)); + }); }); group('test small package', () { @@ -91,7 +101,7 @@ void main() { }); group('Library', () { - Library dartAsyncLib; + Library dartAsyncLib, anonLib; setUp(() { dartAsyncLib = new Library( @@ -99,6 +109,9 @@ void main() { testUtils.sdkDir, testUtils.analyzerHelper.context).first, sdkAsPackage); + anonLib = package.libraries + .firstWhere((lib) => lib.name == 'anonymous_library'); + // Make sure the first library is dart:async expect(dartAsyncLib.name, 'dart:async'); }); @@ -151,12 +164,8 @@ void main() { exLibrary.functions.any((f) => f.name == 'helperFunction'), isFalse); }); - test('anonymous libraries', () { - expect(package.libraries.where((lib) => lib.name == 'anonymous_library'), - hasLength(1)); - expect( - package.libraries.where((lib) => lib.name == 'another_anonymous_lib'), - hasLength(1)); + test('anonymous lib', () { + expect(anonLib.isAnonymous, isTrue); }); });