Commit 6d2ef7a
committed
✅ Fix JRuby local backtrace test assertions
A bug was fixed in jruby-head, but that may not be in current releases:
* JRuby Issue: jruby/jruby#9528
* Fixed by: jruby/jruby#9528
With that issue fixed, these tests don't need to be marked pending! 😄
BUT, JRuby _does_ still have some incongruity between `caller(1)` and
`raise rescue $!.backtrace[1..]`. Some ruby block stack frames in
`caller` are replaced by java stack frames in `Exception#backtrace`.
For example:
```diff
--- Kernel#caller
+++ Exception#backtrace
/home/nick/.local/share/rubies/jruby-dev/lib/ruby/gems/shared/gems/test-unit-3.7.8/lib/test/unit/testcase.rb:632:in 'block in run'
- /home/nick/.local/share/rubies/jruby-dev/lib/ruby/gems/shared/gems/test-unit-3.7.8/lib/test/unit/testcase.rb:631:in 'catch'
+ org/jruby/RubyKernel.java:1604:in 'catch'
+ org/jruby/RubyKernel.java:1599:in 'catch'
/home/nick/.local/share/rubies/jruby-dev/lib/ruby/gems/shared/gems/test-unit-3.7.8/lib/test/unit/testcase.rb:631:in 'run'
```
The workaround is relatively simple: use a locally generated exception
to generate the stack frames for comparison.1 parent df21e99 commit 6d2ef7a
2 files changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
| 227 | + | |
229 | 228 | | |
230 | 229 | | |
231 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
232 | 245 | | |
233 | 246 | | |
234 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
0 commit comments