Skip to content

Commit 891ca5c

Browse files
committed
Fixed unit test for cmdenvironment and made it more robust
1 parent 1a06288 commit 891ca5c

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tests/test_cmd2.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,19 @@ def test_base_cmdenvironment(base_app):
222222
out = run_cmd(base_app, 'cmdenvironment')
223223
expected = normalize("""
224224
225-
Commands are case-sensitive: False
226-
Commands may be terminated with: [';']
227-
Command-line arguments allowed: True
228-
Output redirection and pipes allowed: True
225+
Commands are case-sensitive: {}
226+
Commands may be terminated with: {}
227+
Arguments at invocation allowed: {}
228+
Output redirection and pipes allowed: {}
229229
Parsing of @options commands:
230-
Use POSIX-style argument parser (vs Windows): {}
231-
Strip Quotes when using Windows-style argument parser: {}
232-
Use a list of arguments instead of a single argument string: {}
230+
Shell lexer mode for command argument splitting: {}
231+
Strip Quotes after splitting arguments: {}
232+
Argument type: {}
233233
234-
""".format(cmd2.POSIX_SHLEX, cmd2.STRIP_QUOTES_FOR_NON_POSIX, cmd2.USE_ARG_LIST))
234+
""".format(not base_app.case_insensitive, base_app.terminators, base_app.allow_cli_args, base_app.allow_redirection,
235+
"POSIX" if cmd2.POSIX_SHLEX else "non-POSIX",
236+
"True" if cmd2.STRIP_QUOTES_FOR_NON_POSIX and not cmd2.POSIX_SHLEX else "False",
237+
"List of argument strings" if cmd2.USE_ARG_LIST else "string of space-separated arguments"))
235238
assert out == expected
236239

237240
def test_base_load(base_app, request):

0 commit comments

Comments
 (0)