Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b59378077 |
+23
-18
@@ -1860,28 +1860,33 @@ func TestCommandsReadHelpAsArgument(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestCheckHelpBesideArgument runs check with --help or -h before and after
|
||||
// a directory, and runs help check. Each must print what check --help prints.
|
||||
func TestCheckHelpBesideArgument(t *testing.T) {
|
||||
// TestHelpBesideArgument runs each command that takes a path or URL with
|
||||
// --help or -h before and after a directory, and runs help on that command.
|
||||
// Each must print what the command's own --help prints.
|
||||
func TestHelpBesideArgument(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
want := testOpts([]string{testApp, cmdCheck, testFlagHelp}, afero.NewMemMapFs())
|
||||
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},
|
||||
for _, command := range []string{
|
||||
cmdGenerate, cmdCheck, cmdFreshen, cmdList, cmdExport, cmdFetch,
|
||||
} {
|
||||
t.Run(strings.Join(args, " "), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
want := testOpts([]string{testApp, command, testFlagHelp}, afero.NewMemMapFs())
|
||||
require.Equal(t, 0, runCLI(want))
|
||||
require.Contains(t, testStdout(t, want), testApp+" "+command)
|
||||
|
||||
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))
|
||||
})
|
||||
for _, args := range [][]string{
|
||||
{command, testDir, testFlagHelp},
|
||||
{command, testFlagHelp, testDir},
|
||||
{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