diff options
Diffstat (limited to 'spec/ruby')
-rw-r--r-- | spec/ruby/core/kernel/caller_locations_spec.rb | 14 | ||||
-rw-r--r-- | spec/ruby/core/kernel/caller_spec.rb | 25 | ||||
-rw-r--r-- | spec/ruby/optional/capi/digest_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/optional/capi/string_spec.rb | 4 |
4 files changed, 39 insertions, 10 deletions
diff --git a/spec/ruby/core/kernel/caller_locations_spec.rb b/spec/ruby/core/kernel/caller_locations_spec.rb index aaacd9a910..6074879d59 100644 --- a/spec/ruby/core/kernel/caller_locations_spec.rb +++ b/spec/ruby/core/kernel/caller_locations_spec.rb @@ -83,7 +83,7 @@ describe 'Kernel#caller_locations' do end end - ruby_version_is "3.4" do + ruby_version_is "3.4"..."3.5" do it "includes core library methods defined in Ruby" do file, line = Kernel.instance_method(:tap).source_location file.should.start_with?('<internal:') @@ -94,5 +94,17 @@ describe 'Kernel#caller_locations' do loc.path.should.start_with? "<internal:" end end + + ruby_version_is "3.5" do + it "does not include core library methods defined in Ruby" do + file, line = Kernel.instance_method(:tap).source_location + file.should.start_with?('<internal:') + + loc = nil + tap { loc = caller_locations(1, 1)[0] } + loc.label.should == "Kernel#tap" + loc.path.should == __FILE__ + end + end end end diff --git a/spec/ruby/core/kernel/caller_spec.rb b/spec/ruby/core/kernel/caller_spec.rb index 33c7929a31..4bf9f7c2c2 100644 --- a/spec/ruby/core/kernel/caller_spec.rb +++ b/spec/ruby/core/kernel/caller_spec.rb @@ -84,13 +84,26 @@ describe 'Kernel#caller' do end guard -> { Kernel.instance_method(:tap).source_location } do - it "includes core library methods defined in Ruby" do - file, line = Kernel.instance_method(:tap).source_location - file.should.start_with?('<internal:') + ruby_version_is ""..."3.5" do + it "includes core library methods defined in Ruby" do + file, line = Kernel.instance_method(:tap).source_location + file.should.start_with?('<internal:') + + loc = nil + tap { loc = caller(1, 1)[0] } + loc.should =~ /\A<internal:.*in [`'](?:Kernel#)?tap'\z/ + end + end + + ruby_version_is "3.5" do + it "includes core library methods defined in Ruby" do + file, line = Kernel.instance_method(:tap).source_location + file.should.start_with?('<internal:') - loc = nil - tap { loc = caller(1, 1)[0] } - loc.should =~ /\A<internal:.*in [`'](?:Kernel#)?tap'\z/ + loc = nil + tap { loc = caller(1, 1)[0] } + loc.should =~ /\A#{ __FILE__ }:.*in [`'](?:Kernel#)?tap'\z/ + end end end end diff --git a/spec/ruby/optional/capi/digest_spec.rb b/spec/ruby/optional/capi/digest_spec.rb index c753733906..65c5ecebb1 100644 --- a/spec/ruby/optional/capi/digest_spec.rb +++ b/spec/ruby/optional/capi/digest_spec.rb @@ -1,6 +1,10 @@ require_relative 'spec_helper' -require 'fiddle' +begin + require 'fiddle' +rescue LoadError + return +end load_extension('digest') diff --git a/spec/ruby/optional/capi/string_spec.rb b/spec/ruby/optional/capi/string_spec.rb index 27f65c872a..be9cb9015f 100644 --- a/spec/ruby/optional/capi/string_spec.rb +++ b/spec/ruby/optional/capi/string_spec.rb @@ -1222,7 +1222,7 @@ describe "C-API String function" do -> { str.upcase! }.should raise_error(RuntimeError, 'can\'t modify string; temporarily locked') end - ruby_bug "#20998", ""..."3.6" do # TODO: check when Ruby 3.5 is released + ruby_version_is "3.5" do it "raises FrozenError if string is frozen" do str = -"rb_str_locktmp" -> { @s.rb_str_locktmp(str) }.should raise_error(FrozenError) @@ -1246,7 +1246,7 @@ describe "C-API String function" do -> { @s.rb_str_unlocktmp(+"test") }.should raise_error(RuntimeError, 'temporal unlocking already unlocked string') end - ruby_bug "#20998", ""..."3.6" do # TODO: check when Ruby 3.5 is released + ruby_version_is "3.5" do it "raises FrozenError if string is frozen" do str = -"rb_str_locktmp" -> { @s.rb_str_unlocktmp(str) }.should raise_error(FrozenError) |