mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@15c9619
This commit is contained in:
parent
00c33d9c23
commit
a1b4816759
193 changed files with 3026 additions and 3387 deletions
|
@ -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"]
|
||||
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
|
||||
a = []
|
||||
"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
|
||||
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"]
|
||||
# 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
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue