From 6998d758248d778fa95b008c78d05473e48b8428 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Thu, 29 Jul 2021 22:11:21 +0200 Subject: Update to ruby/spec@b65d01f --- spec/ruby/core/io/set_encoding_by_bom_spec.rb | 6 ++++++ spec/ruby/core/io/ungetbyte_spec.rb | 15 +-------------- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'spec/ruby/core/io') 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) -- cgit v1.2.3