From 22b910c3376df191dc46a65ecbcfa4460142bcd1 Mon Sep 17 00:00:00 2001 From: Janice Collins Date: Thu, 3 Jan 2019 12:04:33 -0800 Subject: [PATCH] Fix help and add test for it --- bin/dartdoc.dart | 1 + test/dartdoc_test.dart | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/bin/dartdoc.dart b/bin/dartdoc.dart index 3626038747..840eef6865 100644 --- a/bin/dartdoc.dart +++ b/bin/dartdoc.dart @@ -120,6 +120,7 @@ Future main(List arguments) async { /// Print help if we are passed the help option. void _printHelp(ArgParser parser) { print('Generate HTML documentation for Dart libraries.\n'); + print(parser.usage); } /// Print usage information on invalid command lines. diff --git a/test/dartdoc_test.dart b/test/dartdoc_test.dart index af0b7d9851..db2be45eba 100644 --- a/test/dartdoc_test.dart +++ b/test/dartdoc_test.dart @@ -152,6 +152,13 @@ void main() { throwsA(const TypeMatcher())); }); + test('help prints command line args', () async { + List outputLines = []; + await subprocessLauncher.runStreamed(Platform.resolvedExecutable, [dartdocPath, '--help'], perLine: outputLines.add); + expect(outputLines, contains('Generate HTML documentation for Dart libraries.')); + expect(outputLines.join('\n'), contains(new RegExp('^-h, --help[ ]+Show command help.', multiLine: true))) ; + }); + test('Validate missing FLUTTER_ROOT exception is clean', () async { StringBuffer output = new StringBuffer(); var args = [dartdocPath];