mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@a6b8805
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6530b14cee
commit
8c5b60eb22
218 changed files with 4069 additions and 328 deletions
|
@ -17,7 +17,7 @@ describe "IO#advise" do
|
|||
}.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "raises a TypeError if offsert cannot be coerced to an Integer" do
|
||||
it "raises a TypeError if offset cannot be coerced to an Integer" do
|
||||
lambda {
|
||||
@io.advise(:normal, "wat")
|
||||
}.should raise_error(TypeError)
|
||||
|
|
|
@ -20,6 +20,18 @@ module IOSpecs
|
|||
"Here is line six.\n" ]
|
||||
end
|
||||
|
||||
def self.lines_without_newline_characters
|
||||
[ "Voici la ligne une.",
|
||||
"Qui \303\250 la linea due.",
|
||||
"",
|
||||
"",
|
||||
"Aqu\303\255 est\303\241 la l\303\255nea tres.",
|
||||
"Hier ist Zeile vier.",
|
||||
"",
|
||||
"Est\303\241 aqui a linha cinco.",
|
||||
"Here is line six." ]
|
||||
end
|
||||
|
||||
def self.lines_limit
|
||||
[ "Voici la l",
|
||||
"igne une.\n",
|
||||
|
|
|
@ -138,6 +138,14 @@ describe "IO#gets" do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.4" do
|
||||
describe "when passed chomp" do
|
||||
it "returns the first line without a trailing newline character" do
|
||||
@io.gets(chomp: true).should == IOSpecs.lines_without_newline_characters[0]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "IO#gets" do
|
||||
|
@ -191,7 +199,7 @@ describe "IO#gets" do
|
|||
@io.gets(obj, 5).should == "one\n"
|
||||
end
|
||||
|
||||
it "reads to the default seperator when passed a single argument greater than the number of bytes to the separator" do
|
||||
it "reads to the default separator when passed a single argument greater than the number of bytes to the separator" do
|
||||
@io.gets(6).should == "one\n"
|
||||
end
|
||||
|
||||
|
|
|
@ -42,4 +42,12 @@ describe "IO#readline" do
|
|||
$_.should == line
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.4" do
|
||||
describe "when passed chomp" do
|
||||
it "returns the first line without a trailing newline character" do
|
||||
@io.readline(chomp: true).should == IOSpecs.lines_without_newline_characters[0]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -114,6 +114,15 @@ describe :io_each, shared: true do
|
|||
ScratchPad.recorded.should == IOSpecs.paragraphs
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.4" do
|
||||
describe "when passed chomp" do
|
||||
it "yields each line without trailing newline characters to the passed block" do
|
||||
@io.send(@method, chomp: true) { |s| ScratchPad << s }
|
||||
ScratchPad.recorded.should == IOSpecs.lines_without_newline_characters
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe :io_each_default_separator, shared: true do
|
||||
|
|
|
@ -17,6 +17,13 @@ describe :io_readlines, shared: true do
|
|||
result = IO.send(@method, @name, "", &@object)
|
||||
(result ? result : ScratchPad.recorded).should == IOSpecs.lines_empty_separator
|
||||
end
|
||||
|
||||
ruby_version_is "2.4" do
|
||||
it "yields a sequence of lines without trailing newline characters when chomp is passed" do
|
||||
result = IO.send(@method, @name, chomp: true, &@object)
|
||||
(result ? result : ScratchPad.recorded).should == IOSpecs.lines_without_newline_characters
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe :io_readlines_options_19, shared: true do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue