aboutsummaryrefslogtreecommitdiffstats
path: root/test/irb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-08-07 23:42:51 +0900
committeraycabta <aycabta@gmail.com>2020-08-18 14:38:01 +0900
commitef498a016b496c20e45dfeaa3064f8033f420336 (patch)
tree40f7b401ad8bb48497ab79b71e44ccc4910a487c /test/irb
parent1359da6ec09d60ac9aef28f2e0df4d7f712f08d3 (diff)
downloadruby-ef498a016b496c20e45dfeaa3064f8033f420336.tar.gz
[ruby/irb] Suppress crash when bignum is set to SAVE_HISTORY
https://github.com/ruby/irb/commit/5044eb2730
Diffstat (limited to 'test/irb')
-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 dbfdf6fb2b..a2554faf26 100644
--- a/test/irb/test_history.rb
+++ b/test/irb/test_history.rb
@@ -52,6 +52,29 @@ module TestIRB
HISTORY_FILE
end
+ def test_history_save_bignum
+ 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] = 10 ** 19
+ 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)