diff options
author | Benoit Daloze <eregontp@gmail.com> | 2021-07-29 22:11:21 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2021-07-29 22:11:21 +0200 |
commit | 6998d758248d778fa95b008c78d05473e48b8428 (patch) | |
tree | 8abc6926f647ea5f374a5b34c3a4820c5861e32e /spec/ruby/core/io | |
parent | 15d05f8120745a121b93fab9fd2addf5f094e8d2 (diff) |
Update to ruby/spec@b65d01f
Diffstat (limited to 'spec/ruby/core/io')
-rw-r--r-- | spec/ruby/core/io/set_encoding_by_bom_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/io/ungetbyte_spec.rb | 15 |
2 files changed, 7 insertions, 14 deletions
diff --git a/spec/ruby/core/io/set_encoding_by_bom_spec.rb b/spec/ruby/core/io/set_encoding_by_bom_spec.rb index c551042bee..7368ec7677 100644 --- a/spec/ruby/core/io/set_encoding_by_bom_spec.rb +++ b/spec/ruby/core/io/set_encoding_by_bom_spec.rb @@ -67,5 +67,11 @@ describe "IO#set_encoding_by_bom" do -> { @io.set_encoding_by_bom }.should raise_error(ArgumentError, 'encoding is set to UTF-8 already') end + + it 'returns exception if encoding conversion is already set' do + @io.set_encoding(Encoding::UTF_8, Encoding::UTF_16BE) + + -> { @io.set_encoding_by_bom }.should raise_error(ArgumentError, 'encoding conversion is set') + end end end diff --git a/spec/ruby/core/io/ungetbyte_spec.rb b/spec/ruby/core/io/ungetbyte_spec.rb index 1e2ec77e1f..776707205a 100644 --- a/spec/ruby/core/io/ungetbyte_spec.rb +++ b/spec/ruby/core/io/ungetbyte_spec.rb @@ -36,20 +36,7 @@ describe "IO#ungetbyte" do @io.getbyte.should == 97 end - ruby_version_is ''...'2.6' do - it "puts back one byte for an Integer argument..." do - @io.ungetbyte(4095).should be_nil - @io.getbyte.should == 255 - end - - it "... but not for Integer argument (eh?)" do - -> { - @io.ungetbyte(0x4f7574206f6620636861722072616e6765) - }.should raise_error(TypeError) - end - end - - ruby_version_is '2.6'...'2.6.1' do + ruby_version_is ''...'2.6.1' do it "is an RangeError if the integer is not in 8bit" do for i in [4095, 0x4f7574206f6620636861722072616e6765] do -> { @io.ungetbyte(i) }.should raise_error(RangeError) |