From 126e1fc2961150a7026b9911a1ed82dbf9557af7 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 8 Aug 2020 20:48:23 +0900 Subject: [ruby/irb] Make history infinite if set SAVE_HISTORY to negative https://github.com/ruby/irb/commit/824473e880 --- test/irb/test_history.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/irb/test_history.rb b/test/irb/test_history.rb index a2554faf26..bd03217fc0 100644 --- a/test/irb/test_history.rb +++ b/test/irb/test_history.rb @@ -75,6 +75,29 @@ module TestIRB HISTORY_FILE end + def test_history_save_minus_as_infinity + result_output, result_history_file = launch_irb_with_irbrc_and_irb_history(<<~IRBRC, <<~IRB_HISTORY) do |stdin| + IRB.conf[:USE_READLINE] = true + IRB.conf[:SAVE_HISTORY] = -1 # infinity + IRBRC + 1 + 2 + 3 + 4 + IRB_HISTORY + stdin.write("5\nexit\n") + end + + assert_equal(<<~HISTORY_FILE, result_history_file) + 1 + 2 + 3 + 4 + 5 + exit + HISTORY_FILE + end + private def launch_irb_with_irbrc_and_irb_history(irbrc, irb_history) -- cgit v1.2.3