summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-06-27 15:51:37 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-06-27 15:51:37 +0200
commitb3fa158d1c4d8e03b8dc04f1e4f9940a8a4ef44c (patch)
treefa8a62d6192c24a21e70aa02589507adfe4e4e6a /spec/ruby/core/io
parent64d8c0815e6ab042e8a67a670bda9f34404fa662 (diff)
Update to ruby/spec@b6b7752
Diffstat (limited to 'spec/ruby/core/io')
-rw-r--r--spec/ruby/core/io/ungetbyte_spec.rb4
-rw-r--r--spec/ruby/core/io/ungetc_spec.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/core/io/ungetbyte_spec.rb b/spec/ruby/core/io/ungetbyte_spec.rb
index 1971dee534..9d189f8abb 100644
--- a/spec/ruby/core/io/ungetbyte_spec.rb
+++ b/spec/ruby/core/io/ungetbyte_spec.rb
@@ -66,6 +66,10 @@ describe "IO#ungetbyte" do
end
end
+ it "raises IOError on stream not opened for reading" do
+ -> { STDOUT.ungetbyte(42) }.should raise_error(IOError, "not opened for reading")
+ end
+
it "raises an IOError if the IO is closed" do
@io.close
-> { @io.ungetbyte(42) }.should raise_error(IOError)
diff --git a/spec/ruby/core/io/ungetc_spec.rb b/spec/ruby/core/io/ungetc_spec.rb
index 85c15b5a71..dc31c3743a 100644
--- a/spec/ruby/core/io/ungetc_spec.rb
+++ b/spec/ruby/core/io/ungetc_spec.rb
@@ -136,6 +136,10 @@ describe "IO#ungetc" do
@io.ungetc(100).should be_nil
end
+ it "raises IOError on stream not opened for reading" do
+ -> { STDOUT.ungetc(100) }.should raise_error(IOError, "not opened for reading")
+ end
+
it "raises IOError on closed stream" do
@io.getc
@io.close