summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-09-17 23:44:07 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2020-09-17 23:44:07 -0400
commit0f11ffa3b992e3f777b96dfe46d4274bfca0dcc8 (patch)
tree8167147ff11f5c9c7aaf1008555248c9c1cd7850 /tests/test_cmd2.py
parentc50def1eff00f7f44adcb911d215ace65d16aa8a (diff)
parentd348f09cf848a566a43b30e04aa6d3adbc4de8bc (diff)
downloadcmd2-git-0f11ffa3b992e3f777b96dfe46d4274bfca0dcc8.tar.gz
Merge branch 'master' into 2.0
Diffstat (limited to 'tests/test_cmd2.py')
-rwxr-xr-xtests/test_cmd2.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index f5c8dbc6..d913b4fc 100755
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -1660,6 +1660,21 @@ def test_alias_create(base_app):
out, err = run_cmd(base_app, 'alias list fake')
assert out == normalize('alias create fake run_pyscript')
+ # Overwrite alias
+ out, err = run_cmd(base_app, 'alias create fake help')
+ assert out == normalize("Alias 'fake' overwritten")
+
+ # Look up the updated alias
+ out, err = run_cmd(base_app, 'alias list fake')
+ assert out == normalize('alias create fake help')
+
+ # Test silent flag
+ out, err = run_cmd(base_app, 'alias create --silent fake set')
+ assert not out
+
+ 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)"""
@@ -1754,6 +1769,21 @@ def test_macro_create(base_app):
out, err = run_cmd(base_app, 'macro list fake')
assert out == normalize('macro create fake run_pyscript')
+ # Overwrite macro
+ out, err = run_cmd(base_app, 'macro create fake help')
+ assert out == normalize("Macro 'fake' overwritten")
+
+ # Look up the updated macro
+ out, err = run_cmd(base_app, 'macro list fake')
+ assert out == normalize('macro create fake help')
+
+ # Test silent flag
+ out, err = run_cmd(base_app, 'macro create --silent fake set')
+ assert not out
+
+ 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)"""
# Create the macro