Fix help and add test for it (#1887)
diff --git a/bin/dartdoc.dart b/bin/dartdoc.dart
index 3626038..840eef6 100644
--- a/bin/dartdoc.dart
+++ b/bin/dartdoc.dart
@@ -120,6 +120,7 @@
/// 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 af0b7d9..db2be45 100644
--- a/test/dartdoc_test.dart
+++ b/test/dartdoc_test.dart
@@ -152,6 +152,13 @@
throwsA(const TypeMatcher<ProcessException>()));
});
+ test('help prints command line args', () async {
+ List<String> 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 = <String>[dartdocPath];