diff options
-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 |