diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-15 06:41:58 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-15 06:41:58 +0000 |
commit | d154bec0d5f0dd32e0d30559ab8a0a7ed8be98d2 (patch) | |
tree | 742aefd4559c4b84b11de474ae6fb005c037faee /spec | |
parent | 5e84537d32c3e2f21071384e2c967fe0308d408d (diff) |
setbyte / ungetbyte allow out-of-range integers
* string.c: String#setbyte to accept arbitrary integers [Bug #15460]
* io.c: ditto for IO#ungetbyte
* ext/strringio/stringio.c: ditto for StringIO#ungetbyte
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/core/io/ungetbyte_spec.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/ruby/core/io/ungetbyte_spec.rb b/spec/ruby/core/io/ungetbyte_spec.rb index 2639d24c45..2e51fb0298 100644 --- a/spec/ruby/core/io/ungetbyte_spec.rb +++ b/spec/ruby/core/io/ungetbyte_spec.rb @@ -49,7 +49,7 @@ describe "IO#ungetbyte" do end end - ruby_version_is '2.6' do + ruby_version_is '2.6'...'2.7' do it "is an RangeError if the integer is not in 8bit" do for i in [4095, 0x4f7574206f6620636861722072616e6765] do lambda { @io.ungetbyte(i) }.should raise_error(RangeError) @@ -57,6 +57,14 @@ describe "IO#ungetbyte" do end end + ruby_version_is '2.7' do + it "never raises RangeError" do + for i in [4095, 0x4f7574206f6620636861722072616e6765] do + lambda { @io.ungetbyte(i) }.should_not raise_error + end + end + end + it "raises an IOError if the IO is closed" do @io.close lambda { @io.ungetbyte(42) }.should raise_error(IOError) |