diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-03-01 18:54:39 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-03-01 18:54:39 -0500 |
commit | baf5e478a5ae9972623513e7853e20e42d9557d7 (patch) | |
tree | 379a78f8a0067238b4cd960608016b6c00798668 /tests/test_cmd2.py | |
parent | 4a6171d92be9e96717d35deea7868add1c10a407 (diff) | |
download | cmd2-git-baf5e478a5ae9972623513e7853e20e42d9557d7.tar.gz |
Added unit tests
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index c8966f57..af1d41c9 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1900,6 +1900,17 @@ def test_alias_create_with_macro_name(base_app, capsys): out, err = capsys.readouterr() assert "Alias cannot have the same name as a macro" in err +def test_alias_that_resolves_into_comment(base_app, capsys): + # Create the alias + out = run_cmd(base_app, 'alias create fake ' + constants.COMMENT_CHAR + ' blah blah') + assert out == normalize("Alias 'fake' created") + + # Use the alias + run_cmd(base_app, 'fake') + out, err = capsys.readouterr() + assert not out + assert not err + def test_alias_list_invalid_alias(base_app, capsys): # Look up invalid alias out = run_cmd(base_app, 'alias list invalid') @@ -2056,6 +2067,17 @@ def test_macro_create_with_missing_unicode_arg_nums(base_app, capsys): out, err = capsys.readouterr() assert "Not all numbers between 1 and 3" in err +def test_macro_that_resolves_into_comment(base_app, capsys): + # Create the macro + out = run_cmd(base_app, 'macro create fake {1} blah blah') + assert out == normalize("Macro 'fake' created") + + # Use the macro + run_cmd(base_app, 'fake ' + constants.COMMENT_CHAR) + out, err = capsys.readouterr() + assert not out + assert not err + def test_macro_list_invalid_macro(base_app, capsys): # Look up invalid macro run_cmd(base_app, 'macro list invalid') |