1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2022-06-26 14:50:14 +02:00
parent f616e81637
commit d3d5ef0cca
74 changed files with 1201 additions and 324 deletions

View file

@ -128,3 +128,23 @@ describe "StringIO#readline when passed [chomp]" do
io.readline(chomp: true).should == "this>is>an>example"
end
end
describe "StringIO#readline when passed [limit]" do
before :each do
@io = StringIO.new("this>is>an>example")
end
it "returns the data read until the limit is met" do
io = StringIO.new("this>is>an>example\n")
io.readline(3).should == "thi"
end
it "returns a blank string when passed a limit of 0" do
@io.readline(0).should == ""
end
it "ignores it when the limit is negative" do
seen = []
@io.readline(-4).should == "this>is>an>example"
end
end