Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: pkg/args/test/command_runner_test.dart

Issue 812743002: Fix the built-in help command in args. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/args/pubspec.yaml ('k') | pkg/args/test/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/args/test/command_runner_test.dart
diff --git a/pkg/args/test/command_runner_test.dart b/pkg/args/test/command_runner_test.dart
index 750e4e1d037def53a3b6ef9f44ac1f9d93d879ee..ba7faeb1900bda08386f6426cd7050aef8bdf66f 100644
--- a/pkg/args/test/command_runner_test.dart
+++ b/pkg/args/test/command_runner_test.dart
@@ -178,6 +178,41 @@ Run "test help" to see global options.
"""));
});
});
+
+ group("with help command", () {
+ test("with no command prints the usage", () {
+ expect(() => runner.run(["help"]), prints("""
+A test command runner.
+
+$_DEFAULT_USAGE
+"""));
+ });
+
+ test("with a command prints the usage for that command", () {
+ var command = new FooCommand();
+ runner.addCommand(command);
+
+ expect(() => runner.run(["help", "foo"]), prints("""
+Set a value.
+
+Usage: test foo [arguments]
+-h, --help Print this usage information.
+
+Run "test help" to see global options.
+"""));
+ });
+
+ test("prints its own usage", () {
+ expect(() => runner.run(["help", "help"]), prints("""
+Display help information for test.
+
+Usage: test help [command]
+-h, --help Print this usage information.
+
+Run "test help" to see global options.
+"""));
+ });
+ });
});
group("with a footer", () {
« no previous file with comments | « pkg/args/pubspec.yaml ('k') | pkg/args/test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698