aboutsummaryrefslogtreecommitdiffhomepage
path: root/command/parse_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'command/parse_test.go')
-rw-r--r--command/parse_test.go40
1 files changed, 18 insertions, 22 deletions
diff --git a/command/parse_test.go b/command/parse_test.go
index c2956c6f..adbb0c30 100644
--- a/command/parse_test.go
+++ b/command/parse_test.go
@@ -70,7 +70,7 @@ func TestParse(t *testing.T) {
"d=0 out of order string flag",
buildTestCommand,
[]string{"string", "--string", "64d3b4b7b21788585845060e2199a78f"},
- "flag provided but not defined: -string\n\nUsage:\ttest string [-h | --help] COMMAND [OPTIONS]\n\n", "",
+ "flag provided but not defined: -string\nusage: test string [-h | --help] <command> [<args>]\n\n", "",
errors.New("flag provided but not defined: -string"),
},
{
@@ -120,7 +120,7 @@ func TestParse(t *testing.T) {
"d=1 empty sub help",
buildTestCommand,
[]string{"empty", "-h"},
- "\nUsage:\ttest empty [-h | --help] COMMAND [OPTIONS]\n\n", "", flag.ErrHelp,
+ "usage: test empty [-h | --help] <command> [<args>]\n\n", "", flag.ErrHelp,
},
{
"d=1 no match",
@@ -151,10 +151,10 @@ func TestParse(t *testing.T) {
"d=0 help",
buildTestCommand,
[]string{},
- `
-Usage: test [-h | --help] [-v] [--fail] [--string <value>] [--int <int>] [--repeat <value>] COMMAND [OPTIONS]
+ `usage: test [-h | --help] [-v] [--fail] [--string <value>] [--int <int>]
+ [--repeat <value>] <command> [<args>]
-Commands:
+commands:
error return an error
print wraps Fprint
string print string passed by flag
@@ -171,10 +171,10 @@ Commands:
"d=0 help flag",
buildTestCommand,
[]string{"-h"},
- `
-Usage: test [-h | --help] [-v] [--fail] [--string <value>] [--int <int>] [--repeat <value>] COMMAND [OPTIONS]
+ `usage: test [-h | --help] [-v] [--fail] [--string <value>] [--int <int>]
+ [--repeat <value>] <command> [<args>]
-Commands:
+commands:
error return an error
print wraps Fprint
string print string passed by flag
@@ -185,7 +185,7 @@ Commands:
succeed this command succeeds
deep top level of command tree with various levels
-Flags:
+flags:
-fail
fail early
-int int
@@ -203,10 +203,9 @@ Flags:
"d=1 help",
buildTestCommand,
[]string{"join"},
- `
-Usage: test join [-h | --help] COMMAND [OPTIONS]
+ `usage: test join [-h | --help] <command> [<args>]
-Commands:
+commands:
out write result to wout
log log result to wlog
@@ -216,10 +215,9 @@ Commands:
"d=1 help flag",
buildTestCommand,
[]string{"join", "-h"},
- `
-Usage: test join [-h | --help] COMMAND [OPTIONS]
+ `usage: test join [-h | --help] <command> [<args>]
-Commands:
+commands:
out write result to wout
log log result to wlog
@@ -230,10 +228,9 @@ Commands:
"d=2 help",
buildTestCommand,
[]string{"deep", "d=2"},
- `
-Usage: test deep d=2 [-h | --help] COMMAND [OPTIONS]
+ `usage: test deep d=2 [-h | --help] <command> [<args>]
-Commands:
+commands:
d=3 relative third level
`, "", command.ErrHelp,
@@ -242,10 +239,9 @@ Commands:
"d=2 help flag",
buildTestCommand,
[]string{"deep", "d=2", "-h"},
- `
-Usage: test deep d=2 [-h | --help] COMMAND [OPTIONS]
+ `usage: test deep d=2 [-h | --help] <command> [<args>]
-Commands:
+commands:
d=3 relative third level
`, "", flag.ErrHelp,
@@ -261,7 +257,7 @@ Commands:
t.Errorf("Parse: error = %v; wantErr %v", err, tc.wantErr)
}
if got := wout.String(); got != tc.want {
- t.Errorf("Parse: %s want %s", got, tc.want)
+ t.Errorf("Parse:\n%s\nwant\n%s", got, tc.want)
}
if gotLog := wlog.String(); gotLog != tc.wantLog {
t.Errorf("Parse: log = %s wantLog %s", gotLog, tc.wantLog)