spring-projects / spring-shell

Spring based shell
http://projects.spring.io/spring-shell/
Apache License 2.0
719 stars 395 forks source link

Non interactive test example fails because of duplicated help argument #1012

Closed mejo1024 closed 5 months ago

mejo1024 commented 6 months ago

I have implemented the tests documented at Spring Shell Testing Basics .

The NonInteractiveTestSample fails for me:

Assertion condition Expected to find AVAILABLE COMMANDS from screen but was NAME
       help - Display help about available commands

SYNOPSIS
       help --command String[] --help

OPTIONS
       --command or -C String[]
       The command to obtain help for.
       [Optional]

       --help or -h
       help for help
       [Optional]

The test send the argument "help help" to shell, but it expects output from the "help" command.

If I run it interactive I see the difference:

shell:>help
help
AVAILABLE COMMANDS

Built-In Commands
       help: Display help about available commands
       stacktrace: Display the full stacktrace of the last error.
       clear: Clear the shell screen.
       quit, exit: Exit the shell.
       history: Display or save the history of previously run commands
       version: Show version info
       script: Read and execute commands from a file.

shell:>
shell:>help help
help help
NAME
       help - Display help about available commands

SYNOPSIS
       help --command String[] --help

OPTIONS
       --command or -C String[]
       The command to obtain help for.
       [Optional]

       --help or -h
       help for help
       [Optional]

So in file TestingSnippets.java Line 74 it should be:

                .nonInterative("help")

Then this test succeed.

Tested with:

jvalkeal commented 5 months ago

You're right, thanks for pointing this out!