diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb index 0c1c527b4..f90360379 100644 --- a/test/irb/test_context.rb +++ b/test/irb/test_context.rb @@ -646,11 +646,11 @@ def test_prompt_main_inspect_escape def test_prompt_part_cached main = Object.new - def main.to_s; "to_s#{rand}"; end - def main.inspect; "inspect#{rand}"; end + def main.to_s; "to_s#{rand(10000)}"; end + def main.inspect; "inspect#{rand(10000)}"; end irb = IRB::Irb.new(IRB::WorkSpace.new(main), TestInputMethod.new) format = '[%m %M %m %M]>' - pattern = /\A\[(to_s[\d.]+) (inspect[\d.]+) \1 \2\]>\z/ + pattern = /\A\[(to_s\d+) (inspect\d+) \1 \2\]>\z/ prompt1, prompt2 = nil irb.send(:with_prompt_part_cached) do