From 12e34a42769780ff9bda98c6a5db1ce621389915 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Sun, 29 May 2022 21:25:05 -0700 Subject: [PATCH] Update rubyspec for stringio bug fix --- spec/ruby/library/stringio/shared/each.rb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/spec/ruby/library/stringio/shared/each.rb b/spec/ruby/library/stringio/shared/each.rb index 14b0a013b3..3be6661ce5 100644 --- a/spec/ruby/library/stringio/shared/each.rb +++ b/spec/ruby/library/stringio/shared/each.rb @@ -36,11 +36,22 @@ describe :stringio_each_separator, shared: true do seen.should == ["2 1 2 1 2"] end - it "yields each paragraph when passed an empty String as separator" do - seen = [] - io = StringIO.new("para1\n\npara2\n\n\npara3") - io.send(@method, "") {|s| seen << s} - seen.should == ["para1\n\n", "para2\n\n", "para3"] + ruby_version_is ''..."3.2" do + it "yields each paragraph with two separation characters when passed an empty String as separator" do + seen = [] + io = StringIO.new("para1\n\npara2\n\n\npara3") + io.send(@method, "") {|s| seen << s} + seen.should == ["para1\n\n", "para2\n\n", "para3"] + end + end + + ruby_version_is "3.2" do + it "yields each paragraph with all separation characters when passed an empty String as separator" do + seen = [] + io = StringIO.new("para1\n\npara2\n\n\npara3") + io.send(@method, "") {|s| seen << s} + seen.should == ["para1\n\n", "para2\n\n\n", "para3"] + end end end