summaryrefslogtreecommitdiff
path: root/spec/rubyspec/library/stringio/readpartial_spec.rb
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 20:18:52 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 20:18:52 +0000
commit1d15d5f08032acf1b7bceacbb450d617ff6e0931 (patch)
treea3785a79899302bc149e4a6e72f624ac27dc1f10 /spec/rubyspec/library/stringio/readpartial_spec.rb
parent75bfc6440d595bf339007f4fb280fd4d743e89c1 (diff)
Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory. [Misc #13792] [ruby-core:82287] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/library/stringio/readpartial_spec.rb')
-rw-r--r--spec/rubyspec/library/stringio/readpartial_spec.rb80
1 files changed, 0 insertions, 80 deletions
diff --git a/spec/rubyspec/library/stringio/readpartial_spec.rb b/spec/rubyspec/library/stringio/readpartial_spec.rb
deleted file mode 100644
index e65e50fa41..0000000000
--- a/spec/rubyspec/library/stringio/readpartial_spec.rb
+++ /dev/null
@@ -1,80 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
-
-describe "StringIO#readpartial" do
- before :each do
- @string = StringIO.new('Stop, look, listen')
- end
-
- after :each do
- @string.close unless @string.closed?
- end
-
- it "raises IOError on closed stream" do
- @string.close
- lambda { @string.readpartial(10) }.should raise_error(IOError)
- end
-
- it "reads at most the specified number of bytes" do
-
- # buffered read
- @string.read(1).should == 'S'
- # return only specified number, not the whole buffer
- @string.readpartial(1).should == "t"
- end
-
- it "reads after ungetc with data in the buffer" do
- c = @string.getc
- @string.ungetc(c)
- @string.readpartial(4).should == "Stop"
- @string.readpartial(3).should == ", l"
- end
-
- it "reads after ungetc without data in the buffer" do
- @string = StringIO.new
- @string.write("f").should == 1
- @string.rewind
- c = @string.getc
- c.should == 'f'
- @string.ungetc(c).should == nil
-
- @string.readpartial(2).should == "f"
- @string.rewind
- # now, also check that the ungot char is cleared and
- # not returned again
- @string.write("b").should == 1
- @string.rewind
- @string.readpartial(2).should == "b"
- end
-
- it "discards the existing buffer content upon successful read" do
- buffer = "existing"
- @string.readpartial(11, buffer)
- buffer.should == "Stop, look,"
- end
-
- it "raises EOFError on EOF" do
- @string.readpartial(18).should == 'Stop, look, listen'
- lambda { @string.readpartial(10) }.should raise_error(EOFError)
- end
-
- it "discards the existing buffer content upon error" do
- buffer = 'hello'
- @string.readpartial(100)
- lambda { @string.readpartial(1, buffer) }.should raise_error(EOFError)
- buffer.should be_empty
- end
-
- it "raises IOError if the stream is closed" do
- @string.close
- lambda { @string.readpartial(1) }.should raise_error(IOError)
- end
-
- it "raises ArgumentError if the negative argument is provided" do
- lambda { @string.readpartial(-1) }.should raise_error(ArgumentError)
- end
-
- it "immediately returns an empty string if the length argument is 0" do
- @string.readpartial(0).should == ""
- end
-end