summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-08-25 11:25:41 -0700
committerJeremy Evans <code@jeremyevans.net>2020-02-27 10:17:54 -0800
commit54499d78109037d7c37bc09a8c3ffa0050da5aca (patch)
tree89d52ead3edc7cd67328ddabb5f6a8f3cbbc9314 /spec
parent229ba1215fa7c8181b9296dff22807fb17442c74 (diff)
Remove support for passing nil to IO#ungetc
Fixes [Bug #13675]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2935
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/core/io/ungetc_spec.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/ruby/core/io/ungetc_spec.rb b/spec/ruby/core/io/ungetc_spec.rb
index 34d4caf745..4be0e3aa8b 100644
--- a/spec/ruby/core/io/ungetc_spec.rb
+++ b/spec/ruby/core/io/ungetc_spec.rb
@@ -103,10 +103,19 @@ describe "IO#ungetc" do
-> { @io.sysread(1) }.should raise_error(IOError)
end
- it "does not affect the stream and returns nil when passed nil" do
- @io.getc.should == ?V
- @io.ungetc(nil)
- @io.getc.should == ?o
+ ruby_version_is "0"..."2.8" do
+ it "does not affect the stream and returns nil when passed nil" do
+ @io.getc.should == ?V
+ @io.ungetc(nil)
+ @io.getc.should == ?o
+ end
+ end
+
+ ruby_version_is "2.8" do
+ it "raises TypeError if passed nil" do
+ @io.getc.should == ?V
+ proc{@io.ungetc(nil)}.should raise_error(TypeError)
+ end
end
it "puts one or more characters back in the stream" do