Skip to content

Commit 50db8f8

Browse files
authored
Fix prompt cache flaky test (#1130)
"#{rand}" might include "e-" which doesn't match to /[\d.]+/
1 parent c95ee78 commit 50db8f8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

test/irb/test_context.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,11 +646,11 @@ def test_prompt_main_inspect_escape
646646

647647
def test_prompt_part_cached
648648
main = Object.new
649-
def main.to_s; "to_s#{rand}"; end
650-
def main.inspect; "inspect#{rand}"; end
649+
def main.to_s; "to_s#{rand(10000)}"; end
650+
def main.inspect; "inspect#{rand(10000)}"; end
651651
irb = IRB::Irb.new(IRB::WorkSpace.new(main), TestInputMethod.new)
652652
format = '[%m %M %m %M]>'
653-
pattern = /\A\[(to_s[\d.]+) (inspect[\d.]+) \1 \2\]>\z/
653+
pattern = /\A\[(to_s\d+) (inspect\d+) \1 \2\]>\z/
654654

655655
prompt1, prompt2 = nil
656656
irb.send(:with_prompt_part_cached) do

0 commit comments

Comments
 (0)