summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-09-30 14:19:13 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2020-09-30 20:36:46 -0400
commit018c329a4df9f3b84227cf33a14f9482f3e7eb2a (patch)
treeaaaedcef9a4391b9952d0da48e54e8672ef738c1 /tests/test_cmd2.py
parented7b9e5185fd14808aa26e61a26968b9753beee0 (diff)
downloadcmd2-git-018c329a4df9f3b84227cf33a14f9482f3e7eb2a.tar.gz
Fixed issue where quoted redirectors and terminators in aliases and macros were not being
restored when read from a startup script.
Diffstat (limited to 'tests/test_cmd2.py')
-rwxr-xr-xtests/test_cmd2.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 1e4f4844..034f7096 100755
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -1639,16 +1639,17 @@ def test_alias_create(base_app):
out, err = run_cmd(base_app, 'alias list --with_silent fake')
assert out == normalize('alias create --silent fake set')
-def test_alias_create_with_quoted_value(base_app):
- """Demonstrate that quotes in alias value will be preserved (except for redirectors and terminators)"""
+def test_alias_create_with_quoted_tokens(base_app):
+ """Demonstrate that quotes in alias value will be preserved"""
+ create_command = 'alias create fake help ">" "out file.txt" ";"'
# Create the alias
- out, err = run_cmd(base_app, 'alias create fake help ">" "out file.txt" ";"')
+ out, err = run_cmd(base_app, create_command)
assert out == normalize("Alias 'fake' created")
- # Look up the new alias (Only the redirector should be unquoted)
+ # Look up the new alias and verify all quotes are preserved
out, err = run_cmd(base_app, 'alias list fake')
- assert out == normalize('alias create fake help > "out file.txt" ;')
+ assert out == normalize(create_command)
@pytest.mark.parametrize('alias_name', invalid_command_name)
def test_alias_create_invalid_name(base_app, alias_name, capsys):
@@ -1748,15 +1749,17 @@ def test_macro_create(base_app):
out, err = run_cmd(base_app, 'macro list --with_silent fake')
assert out == normalize('macro create --silent fake set')
-def test_macro_create_with_quoted_value(base_app):
- """Demonstrate that quotes in macro value will be preserved (except for redirectors and terminators)"""
+def test_macro_create_with_quoted_tokens(base_app):
+ """Demonstrate that quotes in macro value will be preserved"""
+ create_command = 'macro create fake help ">" "out file.txt" ";"'
+
# Create the macro
- out, err = run_cmd(base_app, 'macro create fake help ">" "out file.txt" ";"')
+ out, err = run_cmd(base_app, create_command)
assert out == normalize("Macro 'fake' created")
- # Look up the new macro (Only the redirector should be unquoted)
+ # Look up the new macro and verify all quotes are preserved
out, err = run_cmd(base_app, 'macro list fake')
- assert out == normalize('macro create fake help > "out file.txt" ;')
+ assert out == normalize(create_command)
@pytest.mark.parametrize('macro_name', invalid_command_name)
def test_macro_create_invalid_name(base_app, macro_name):