diff options
author | Jean Boussier <[email protected]> | 2024-02-19 11:30:26 +0100 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2024-03-14 11:38:40 +0100 |
commit | 315bde5a0f95562f58405a43456ec6715ef20d32 (patch) | |
tree | c499f36305afbc3fb7a4d087708e8dafd6f1ff89 /spec/ruby/shared/kernel | |
parent | 5326337d4f15ccf33128b3cf5a8896ba7f91fcc4 (diff) |
`Exception#set_backtrace` accept arrays of `Backtrace::Location`
[Feature #13557]
Setting the backtrace with an array of strings is lossy. The resulting
exception will return nil on `#backtrace_locations`.
By accepting an array of `Backtrace::Location` instance, we can rebuild
a `Backtrace` instance and have a fully functioning Exception.
Co-Authored-By: Étienne Barrié <[email protected]>
Diffstat (limited to 'spec/ruby/shared/kernel')
-rw-r--r-- | spec/ruby/shared/kernel/raise.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/shared/kernel/raise.rb b/spec/ruby/shared/kernel/raise.rb index 82fb0333c8..4b60951f24 100644 --- a/spec/ruby/shared/kernel/raise.rb +++ b/spec/ruby/shared/kernel/raise.rb @@ -146,4 +146,12 @@ describe :kernel_raise, shared: true do @object.raise(ArgumentError, "message", caller) end.should raise_error(ArgumentError, "message") end + + ruby_version_is "3.4" do + it "allows Exception, message, and backtrace_locations parameters" do + -> do + @object.raise(ArgumentError, "message", caller_locations) + end.should raise_error(ArgumentError, "message") + end + end end |