diff options
| author | Andrew Konchin <andry.konchin@gmail.com> | 2025-06-02 19:34:54 +0300 |
|---|---|---|
| committer | Benoit Daloze <eregontp@gmail.com> | 2025-06-02 21:54:48 +0200 |
| commit | d6aa1714fed3e8b5ee8bede00a8853c338ff6092 (patch) | |
| tree | ea863a44d9026f74b9a07375f401c3e5d8cb4bf5 /spec/ruby/language/predefined_spec.rb | |
| parent | 685c8ca9af892f562f64b54dbee73bb9a1999b90 (diff) | |
Update to ruby/spec@4d2fc4d
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13495
Diffstat (limited to 'spec/ruby/language/predefined_spec.rb')
| -rw-r--r-- | spec/ruby/language/predefined_spec.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/ruby/language/predefined_spec.rb b/spec/ruby/language/predefined_spec.rb index 91019cfe56..d90e19858a 100644 --- a/spec/ruby/language/predefined_spec.rb +++ b/spec/ruby/language/predefined_spec.rb @@ -1,4 +1,5 @@ require_relative '../spec_helper' +require_relative '../core/exception/shared/set_backtrace' require 'stringio' # The following tables are excerpted from Programming Ruby: The Pragmatic Programmer's Guide' @@ -621,6 +622,17 @@ describe "Predefined global $@" do end end + it_behaves_like :exception_set_backtrace, -> backtrace { + exception = nil + begin + raise + rescue + $@ = backtrace + exception = $! + end + exception + } + it "cannot be assigned when there is no a rescued exception" do -> { $@ = [] @@ -1063,8 +1075,14 @@ describe "Execution variable $:" do it "default $LOAD_PATH entries until sitelibdir included have @gem_prelude_index set" do skip "no sense in ruby itself" if MSpecScript.instance_variable_defined?(:@testing_ruby) - $:.should.include?(RbConfig::CONFIG['sitelibdir']) - idx = $:.index(RbConfig::CONFIG['sitelibdir']) + if platform_is :windows + # See https://github.com/ruby/setup-ruby/pull/762#issuecomment-2917460440 + $:.should.find { |e| File.realdirpath(e) == RbConfig::CONFIG['sitelibdir'] } + idx = $:.index { |e| File.realdirpath(e) == RbConfig::CONFIG['sitelibdir'] } + else + $:.should.include?(RbConfig::CONFIG['sitelibdir']) + idx = $:.index(RbConfig::CONFIG['sitelibdir']) + end $:[idx..-1].all? { |p| p.instance_variable_defined?(:@gem_prelude_index) }.should be_true $:[0...idx].all? { |p| !p.instance_variable_defined?(:@gem_prelude_index) }.should be_true |
