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 | |
| 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')
| -rw-r--r-- | tests/conftest.py | 3 | ||||
| -rw-r--r-- | tests/test_cmd2.py | 45 | ||||
| -rw-r--r-- | tests/test_transcript.py | 4 | ||||
| -rw-r--r-- | tests/transcripts/from_cmdloop.txt | 4 |
4 files changed, 27 insertions, 29 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index c9a9ab0e..e20d2511 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,8 +15,7 @@ import cmd2 # Help text for base cmd2.Cmd application BASE_HELP = """Documented commands (type help <topic>): ======================================== -cmdenvironment help load pyscript run set shortcuts -edit history py quit save shell +edit help history load py pyscript quit run save set shell shortcuts """ # Help text for the history command 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: ====================== diff --git a/tests/test_transcript.py b/tests/test_transcript.py index 08cde665..193e135f 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -130,8 +130,8 @@ def test_base_with_transcript(_cmdline_app): Documented commands (type help <topic>): ======================================== -cmdenvironment help load orate pyscript run say shell speak -edit history mumble py quit save set shortcuts +edit history mumble py quit save set shortcuts +help load orate pyscript run say shell speak (Cmd) help say Repeats what you tell me to. diff --git a/tests/transcripts/from_cmdloop.txt b/tests/transcripts/from_cmdloop.txt index 401860ad..3deed8cf 100644 --- a/tests/transcripts/from_cmdloop.txt +++ b/tests/transcripts/from_cmdloop.txt @@ -5,8 +5,8 @@ Documented commands (type help <topic>): ======================================== -cmdenvironment help load orate pyscript run say shell speak/ */ -edit history mumble py quit save set shortcuts/ */ +edit history mumble py quit save set shortcuts/ */ +help load orate pyscript run say shell speak/ */ (Cmd) help say Repeats what you tell me to. |
