diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-09-10 21:32:56 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-09-10 21:32:56 -0400 |
commit | cf9516e5d25df5e4e330f75ab0f800ba8b4217c8 (patch) | |
tree | 0fe19f79b851ca7d3bccab0328c40cbd6e2d884a /tests/test_cmd2.py | |
parent | d25534abb4c1dac20defe52959040c43ba525d2f (diff) | |
download | cmd2-git-cf9516e5d25df5e4e330f75ab0f800ba8b4217c8.tar.gz |
Added --silent flag to alias/macro create.
Added --with_silent flag to alias/macro list.
Diffstat (limited to 'tests/test_cmd2.py')
-rwxr-xr-x | tests/test_cmd2.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index be6f52d1..1e4f4844 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1624,6 +1624,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)""" @@ -1718,6 +1733,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 |