Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proc#source_location returns [path, start_line, start_column, end_line, end_column] with Ruby 3.5.0dev #292

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yahonda
Copy link
Contributor

@yahonda yahonda commented Mar 18, 2025

Description

This pull request supports Ruby 3.5.0dev since Proc#source_location returns [path, start_line, start_column, end_line, end_column]

This commit addresses the following spec failure with ruby 3.5.0dev since Proc#source_location returns [path, start_line, start_column, end_line, end_column].

Proc#source_location returns [path, start_line] with Ruby 3.4 or earlier.

% ruby -v
ruby 3.5.0dev (2025-03-12T09:42:39Z master b8af9325c0) +PRISM [arm64-darwin24]
% ruby -e 'p proc { true }.source_location'
["-e", 1, 7, 1, 15]

% ruby -v
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [arm64-darwin24]
% ruby -e 'p proc { true }.source_location'
["-e", 1]
% ruby -v
ruby 3.5.0dev (2025-03-12T09:42:39Z master b8af9325c0) +PRISM [arm64-darwin24]
% bundle exec rspec ./spec/cucumber/core/test/runner_spec.rb:27
Run options:
  include {locations: {"./spec/cucumber/core/test/runner_spec.rb" => [27]}}
  exclude {slow: true}
F

Failures:

  1) Cucumber::Core::Test::Runner when reporting the duration of a test case with a passing test case records the nanoseconds duration of the execution on the result
     Failure/Error:
       def self.new(file, raw_lines = nil)
         file || raise(ArgumentError, 'file is mandatory')
         if raw_lines
           Precise.new(file, Lines.new(raw_lines))
         else
           Wildcard.new(file)

     ArgumentError:
       wrong number of arguments (given 5, expected 1..2)
     # ./lib/cucumber/core/test/location.rb:32:in 'new'
     # ./lib/cucumber/core/test/action/defined.rb:17:in 'Cucumber::Core::Test::Action::Defined#initialize'
     # ./lib/cucumber/core/test/step.rb:40:in 'Class#new'
     # ./lib/cucumber/core/test/step.rb:40:in 'Cucumber::Core::Test::Step#with_action'
     # ./spec/support/shared_context/test_step_types.rb:6:in 'block (2 levels) in <top (required)>'
     # ./spec/cucumber/core/test/runner_spec.rb:25:in 'block (4 levels) in <top (required)>'
     # ./spec/cucumber/core/test/runner_spec.rb:13:in 'block (2 levels) in <top (required)>'
     # ./spec/cucumber/core/test/runner_spec.rb:31:in 'block (4 levels) in <top (required)>'

Finished in 0.00272 seconds (files took 0.07305 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/cucumber/core/test/runner_spec.rb:27 # Cucumber::Core::Test::Runner when reporting the duration of a test case with a passing test case records the nanoseconds duration of the execution on the result

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Note to other contributors

Refer to ruby/ruby#12539 https://bugs.ruby-lang.org/issues/6012 for the background of this change.

Checklist:

Your PR is ready for review once the following checklist is
complete. You can also add some checks if you want to.

  • Tests have been added for any changes to behaviour of the code
  • New and existing tests are passing locally and on CI
  • bundle exec rubocop reports no offenses
  • RDoc comments have been updated
  • CHANGELOG.md has been updated

@faisal
Copy link

faisal commented Mar 27, 2025

Once this lands in HEAD could it also go into a 13.0.x update?

@yahonda yahonda marked this pull request as ready for review March 31, 2025 01:10
@luke-hill
Copy link
Contributor

@yahonda Thanks for the work. I'll get round to reviewing this when I have time. Priorities at the moment are seeing me look at cucumber-ruby predominantly. So this likely won't be for a couple of weeks

@faisal At the moment the first priority is getting cucumber v10 out. As that has several major updates for a lot of the downstream gems. So it's likely a cut / release of this won't be the next thing to come

@luke-hill luke-hill self-requested a review March 31, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants