diff --git a/testing/test_readline.py b/testing/test_readline.py index a9a2a2c..e67c019 100644 --- a/testing/test_readline.py +++ b/testing/test_readline.py @@ -103,3 +103,15 @@ def replace(cls, *args): readline_wrapper.write_history_file(str(histfile)) assert open(str(histfile), "r").readlines() == ["foo\n", "bar\n"] + + +@pytest.mark.parametrize('auto_history,expected', [(True, 1), (False, 0)]) +def test_set_auto_history(auto_history, expected): + master, slave = pty.openpty() + readline_wrapper = _ReadlineWrapper(slave, slave) + readline_wrapper.set_auto_history(auto_history) + + os.write(master, b'input\n') + readline_wrapper.get_reader().readline() + + assert readline_wrapper.get_current_history_length() == expected