aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-08-08 20:48:23 +0900
committeraycabta <aycabta@gmail.com>2020-08-18 14:38:01 +0900
commit126e1fc2961150a7026b9911a1ed82dbf9557af7 (patch)
tree48eace45728ad58c80ad3c9c45ed1b449bcd21eb /test
parentef498a016b496c20e45dfeaa3064f8033f420336 (diff)
downloadruby-126e1fc2961150a7026b9911a1ed82dbf9557af7.tar.gz
[ruby/irb] Make history infinite if set SAVE_HISTORY to negative
https://github.com/ruby/irb/commit/824473e880
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_history.rb23
1 files changed, 23 insertions, 0 deletions
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)