patbenatar / rbexy

A Ruby template language and component framework inspired by JSX and React
MIT License
34 stars 5 forks source link

Add Support for Ruby 3.3 #98

Closed zacheryph closed 2 months ago

zacheryph commented 2 months ago

Ruby 3.3 alters a few Backtrace related things. These need to be worked out before introducing it.

One spec in rbexy_spec.rb fails cause the backtrace was altered from (eval) ... => (eval at file/name:NN) ..., this is easy enough to fix.

The tougher issue is the test in component_spec.rb.

# Spec expectation
expect(error.backtrace[1]).to include "erroring_component.rbx:3:in `times'"

# Ruby 3.3 Backtrace however contains
"<internal:numeric>:237:in `times'"
patbenatar commented 2 months ago

What's the full backtrace that the code is trying to clean in this component_spec on 3.2 vs 3.3?

zacheryph commented 2 months ago

The test is at: https://github.com/patbenatar/rbexy/blob/master/spec/integration/component_spec.rb#L64-L71

# <= 3.2 Backtrace
.../rbexy/spec/dummy/app/components/erroring_component.rbx:3:in `_app_components_erroring_component_rbx__4440106192735971761_14040'
.../rbexy/spec/dummy/app/components/erroring_component.rbx:3:in `times'
.../rbexy/spec/integration/component_spec.rb:65:in `block (3 levels) in <top (required)>'

# 3.3 Backtrace
.../rbexy/spec/dummy/app/components/erroring_component.rbx:3:in `_app_components_erroring_component_rbx___1849024185177004464_14060'
<internal:numeric>:237:in `times'
.../rbexy/spec/integration/component_spec.rb:65:in `block (3 levels) in <top (required)>'

As you can see the location of the in 'times' is getting altered. I did not get a chance to look into the 3.3 changelog too much yet.

Given that the first line still has the proper line number I wonder if we just... "deal with it"? I don't know how rbexy is responsible for defining the file/line number?

patbenatar commented 2 months ago

Given that the first line still has the proper line number I wonder if we just... "deal with it"?

I agree with that. I think what matters most is that this assertion passes. If the second line in the backtrace is <internal:numeric>:237:intimes'` that's fine.