diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-21 18:24:14 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-21 18:24:14 -0400 |
commit | 86f5a2886cc14fd18933e0a201e064ac7e6fd2d1 (patch) | |
tree | d37d0b921522eb042ebdc32b9a92e2c4594ae7c7 /tests/test_cmd2.py | |
parent | 7e9b56789ceb05d23b8d61e619b53f1a1fda111d (diff) | |
download | cmd2-git-86f5a2886cc14fd18933e0a201e064ac7e6fd2d1.tar.gz |
Added unit test
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 4a9dca31..01e6e271 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1853,6 +1853,21 @@ def test_onecmd_raw_str_quit(outsim_app): assert stop assert out == '' +def test_onecmd_add_to_history(outsim_app): + line = "help" + saved_hist_len = len(outsim_app.history) + + # Allow command to be added to history + outsim_app.onecmd(line, add_to_history=True) + new_hist_len = len(outsim_app.history) + assert new_hist_len == saved_hist_len + 1 + + saved_hist_len = new_hist_len + + # Prevent command from being added to history + outsim_app.onecmd(line, add_to_history=False) + new_hist_len = len(outsim_app.history) + assert new_hist_len == saved_hist_len def test_get_all_commands(base_app): # Verify that the base app has the expected commands |