Skip to content

Commit

Permalink
added test for when the history_file does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ignacio-chiazzo committed Feb 2, 2024
1 parent 9bf0242 commit 1735db9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/irb/test_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1735db9

Please sign in to comment.