diff options
author | Benoit Daloze <[email protected]> | 2019-04-27 18:53:23 +0200 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2019-04-27 18:53:23 +0200 |
commit | a1b4816759418ca8fe510e8739622fc5d77ab0f0 (patch) | |
tree | 9d4fb6091d0086817f5bde46bf1150e9130d34fd /spec/ruby/core/string/shared | |
parent | 00c33d9c232ed1a79eda17acd7231ac93caa162b (diff) |
Update to ruby/spec@15c9619
Diffstat (limited to 'spec/ruby/core/string/shared')
-rw-r--r-- | spec/ruby/core/string/shared/each_line.rb | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/spec/ruby/core/string/shared/each_line.rb b/spec/ruby/core/string/shared/each_line.rb index 066b0c1040..86c966e50b 100644 --- a/spec/ruby/core/string/shared/each_line.rb +++ b/spec/ruby/core/string/shared/each_line.rb @@ -145,34 +145,32 @@ describe :string_each_line, shared: true do lambda { "hello world".send(@method, :o).to_a }.should raise_error(TypeError) end - ruby_version_is '2.4' do - context "when `chomp` keyword argument is passed" do - it "removes new line characters when separator is not specified" do - a = [] - "hello \nworld\n".send(@method, chomp: true) { |s| a << s } - a.should == ["hello ", "world"] - - a = [] - "hello \r\nworld\r\n".send(@method, chomp: true) { |s| a << s } - a.should == ["hello ", "world"] - end + context "when `chomp` keyword argument is passed" do + it "removes new line characters when separator is not specified" do + a = [] + "hello \nworld\n".send(@method, chomp: true) { |s| a << s } + a.should == ["hello ", "world"] - it "removes only specified separator" do - a = [] - "hello world".send(@method, ' ', chomp: true) { |s| a << s } - a.should == ["hello", "world"] - end + a = [] + "hello \r\nworld\r\n".send(@method, chomp: true) { |s| a << s } + a.should == ["hello ", "world"] + end - # https://bugs.ruby-lang.org/issues/14257 - it "ignores new line characters when separator is specified" do - a = [] - "hello\n world\n".send(@method, ' ', chomp: true) { |s| a << s } - a.should == ["hello\n", "world\n"] + it "removes only specified separator" do + a = [] + "hello world".send(@method, ' ', chomp: true) { |s| a << s } + a.should == ["hello", "world"] + end - a = [] - "hello\r\n world\r\n".send(@method, ' ', chomp: true) { |s| a << s } - a.should == ["hello\r\n", "world\r\n"] - end + # https://bugs.ruby-lang.org/issues/14257 + it "ignores new line characters when separator is specified" do + a = [] + "hello\n world\n".send(@method, ' ', chomp: true) { |s| a << s } + a.should == ["hello\n", "world\n"] + + a = [] + "hello\r\n world\r\n".send(@method, ' ', chomp: true) { |s| a << s } + a.should == ["hello\r\n", "world\r\n"] end end end |