diff --git a/test/irb/test_history.rb b/test/irb/test_history.rb index fef42b498..1041caeba 100644 --- a/test/irb/test_history.rb +++ b/test/irb/test_history.rb @@ -167,6 +167,23 @@ def test_history_different_encodings $VERBOSE = verbose_bak end + def test_history_does_not_raise_when_history_file_directory_does_not_exist + backup_history_file = IRB.conf[:HISTORY_FILE] + IRB.conf[:SAVE_HISTORY] = 1 + IRB.conf[:HISTORY_FILE] = "fake/fake/fake/history_file" + io = TestInputMethodWithRelineHistory.new + io.class::HISTORY.clear + io.load_history + io.class::HISTORY << 'line1' + io.class::HISTORY << 'line2' + + assert_nothing_raised do + io.save_history + end + ensure + IRB.conf[:HISTORY_FILE] = backup_history_file + end + private def history_concurrent_use_for_input_method(input_method)