Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4f5d375b5 |
+18
-23
@@ -1860,33 +1860,28 @@ func TestCommandsReadHelpAsArgument(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestHelpBesideArgument runs each command that takes a path or URL with
|
// TestCheckHelpBesideArgument runs check with --help or -h before and after
|
||||||
// --help or -h before and after a directory, and runs help on that command.
|
// a directory, and runs help check. Each must print what check --help prints.
|
||||||
// Each must print what the command's own --help prints.
|
func TestCheckHelpBesideArgument(t *testing.T) {
|
||||||
func TestHelpBesideArgument(t *testing.T) {
|
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
for _, command := range []string{
|
want := testOpts([]string{testApp, cmdCheck, testFlagHelp}, afero.NewMemMapFs())
|
||||||
cmdGenerate, cmdCheck, cmdFreshen, cmdList, cmdExport, cmdFetch,
|
require.Equal(t, 0, runCLI(want))
|
||||||
|
require.Contains(t, testStdout(t, want), "Validate files using manifest file")
|
||||||
|
|
||||||
|
for _, args := range [][]string{
|
||||||
|
{cmdCheck, testDir, testFlagHelp},
|
||||||
|
{cmdCheck, testFlagHelp, testDir},
|
||||||
|
{cmdCheck, testDir, "-h"},
|
||||||
|
{testCmdHelp, cmdCheck},
|
||||||
} {
|
} {
|
||||||
want := testOpts([]string{testApp, command, testFlagHelp}, afero.NewMemMapFs())
|
t.Run(strings.Join(args, " "), func(t *testing.T) {
|
||||||
require.Equal(t, 0, runCLI(want))
|
t.Parallel()
|
||||||
require.Contains(t, testStdout(t, want), testApp+" "+command)
|
|
||||||
|
|
||||||
for _, args := range [][]string{
|
opts := testOpts(slices.Concat([]string{testApp}, args), afero.NewMemMapFs())
|
||||||
{command, testDir, testFlagHelp},
|
assert.Equal(t, 0, runCLI(opts), testStderr(t, opts))
|
||||||
{command, testFlagHelp, testDir},
|
assert.Equal(t, testStdout(t, want), testStdout(t, opts))
|
||||||
{command, testDir, "-h"},
|
})
|
||||||
{testCmdHelp, command},
|
|
||||||
} {
|
|
||||||
t.Run(strings.Join(args, " "), func(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
opts := testOpts(slices.Concat([]string{testApp}, args), afero.NewMemMapFs())
|
|
||||||
assert.Equal(t, 0, runCLI(opts), testStderr(t, opts))
|
|
||||||
assert.Equal(t, testStdout(t, want), testStdout(t, opts))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user