diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-15 15:49:18 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-15 15:49:18 -0500 |
commit | f7cc1610c8a5d981ab5ee728d61ab241ecf5d8fd (patch) | |
tree | 2d0eb41adc95e8d320a3daef504ad4348d16bace /tests/test_cmd2.py | |
parent | b89cbb453236ed22f384751880f36ad35a315237 (diff) | |
download | cmd2-git-f7cc1610c8a5d981ab5ee728d61ab241ecf5d8fd.tar.gz |
cmdenvironment command has been removed and its functionality now exists as a -a/--all option to the set command
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 3295bb60..556578d5 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -54,7 +54,7 @@ def test_base_invalid_option(base_app, capsys): run_cmd(base_app, 'set -z') out, err = capsys.readouterr() run_cmd(base_app, 'help set') - expected = ['usage: set [-h] [-l] [settable [settable ...]]', 'set: error: unrecognized arguments: -z'] + expected = ['usage: set [-h] [-a] [-l] [settable [settable ...]]', 'set: error: unrecognized arguments: -z'] assert normalize(str(err)) == expected def test_base_shortcuts(base_app): @@ -79,6 +79,25 @@ def test_base_show_long(base_app): assert out == expected +def test_base_show_readonly(base_app): + out = run_cmd(base_app, 'set -a') + expected = normalize(SHOW_TXT + '\nRead only settings:' + """ + Commands are case-sensitive: {} + Commands may be terminated with: {} + Arguments at invocation allowed: {} + Output redirection and pipes allowed: {} + Parsing of @options commands: + Shell lexer mode for command argument splitting: {} + Strip Quotes after splitting arguments: {} + Argument type: {} + +""".format(not base_app.case_insensitive, base_app.terminators, base_app.allow_cli_args, base_app.allow_redirection, + "POSIX" if cmd2.POSIX_SHLEX else "non-POSIX", + "True" if cmd2.STRIP_QUOTES_FOR_NON_POSIX and not cmd2.POSIX_SHLEX else "False", + "List of argument strings" if cmd2.USE_ARG_LIST else "string of space-separated arguments")) + assert out == expected + + def test_base_set(base_app): out = run_cmd(base_app, 'set quiet True') expected = normalize(""" @@ -296,26 +315,6 @@ def test_history_with_span_index_error(base_app): """) assert out == expected - -def test_base_cmdenvironment(base_app): - out = run_cmd(base_app, 'cmdenvironment') - expected = normalize(""" - - Commands are case-sensitive: {} - Commands may be terminated with: {} - Arguments at invocation allowed: {} - Output redirection and pipes allowed: {} - Parsing of @options commands: - Shell lexer mode for command argument splitting: {} - Strip Quotes after splitting arguments: {} - Argument type: {} - -""".format(not base_app.case_insensitive, base_app.terminators, base_app.allow_cli_args, base_app.allow_redirection, - "POSIX" if cmd2.POSIX_SHLEX else "non-POSIX", - "True" if cmd2.STRIP_QUOTES_FOR_NON_POSIX and not cmd2.POSIX_SHLEX else "False", - "List of argument strings" if cmd2.USE_ARG_LIST else "string of space-separated arguments")) - assert out == expected - def test_base_load(base_app, request): test_dir = os.path.dirname(request.module.__file__) filename = os.path.join(test_dir, 'script.txt') @@ -1097,8 +1096,8 @@ def test_custom_help_menu(help_app): expected = normalize(""" Documented commands (type help <topic>): ======================================== -cmdenvironment help load pyscript run set shortcuts -edit history py quit save shell squat +edit history py quit save shell squat +help load pyscript run set shortcuts Undocumented commands: ====================== |