mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@6f38a82
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b864bd05bf
commit
4fbb9aa3cb
145 changed files with 2847 additions and 2596 deletions
|
@ -51,9 +51,8 @@ describe :string_each_line, shared: true do
|
|||
end
|
||||
end
|
||||
|
||||
quarantine! do # Currently fails on Travis
|
||||
ruby_version_is '2.5' do
|
||||
it "yields paragraphs (broken by 2 or more successive newlines) when passed ''" do
|
||||
it "yields paragraphs (broken by 2 or more successive newlines) when passed '' and replaces multiple newlines with only two ones" do
|
||||
a = []
|
||||
"hello\nworld\n\n\nand\nuniverse\n\n\n\n\n".send(@method, '') { |s| a << s }
|
||||
a.should == ["hello\nworld\n\n", "and\nuniverse\n\n"]
|
||||
|
@ -63,7 +62,6 @@ quarantine! do # Currently fails on Travis
|
|||
a.should == ["hello\nworld\n\n", "and\nuniverse\n\n", "dog"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "uses $/" do
|
||||
before :each do
|
||||
|
@ -136,7 +134,7 @@ end
|
|||
|
||||
ruby_version_is '2.4' do
|
||||
context "when `chomp` keyword argument is passed" do
|
||||
it "removes new line characters" 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"]
|
||||
|
@ -145,6 +143,23 @@ end
|
|||
"hello \r\nworld\r\n".send(@method, chomp: true) { |s| a << s }
|
||||
a.should == ["hello ", "world"]
|
||||
end
|
||||
|
||||
it "removes only specified separator" do
|
||||
a = []
|
||||
"hello world".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"]
|
||||
|
||||
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
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue