Add #original_location to Cucumber::Core::Ast::Step and Cucumber::Core::Test::Step #150
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add Cucumber::Core::Ast::Step#original_location.
Details
The intention is to make the location of the OutlineStep easily accessible from the source of a Cucumber::Core::Test::Step.
Motivation and Context
A Test Step from a Scenario Outline has two locations, the location of the Outline Step and the location of the Example Table Row. This is made explicit by the Gherkin compiler in that a Pickle Step has a locations attribute, that in case of that the Pickle Step was compiled from a Scenario Outline contains both the location of the Outline Step and the Example Table Row. The Cucumber-Ruby compiler does not take this into account, the
Ast::Step
,Ast::ExpandedOutlineStep
andTest::Step
all (through include of theHasLocation
module) all respond to the#location
method to provide one and only one location. In case ofAst::ExpandedOutlineStep
andTest::Step
the location provided is the location of the Example Table Row.Since
Ast::ExpandedOutlineStep
andTest::Step
has two equally important locations (neither cannot be deduced from the other), they should in principle not provide a#location
method. However since the use of theHasLocation
module and the#location
method is ubiquitous and depended on in many placed. This PR instead introduce a#original_location
onAst::Step
andAst::ExpandedOutlineStep
so that both the locations of a Test Step from a Scenario Outline can be easily accessible from the source (#source.last
) of the Test Step, without first having to determine whether the Test Step comes from a Scenario or a Scenario Outline.Fixes #149.
How Has This Been Tested?
The automated test suite has been extended to verify this behavior.
Types of changes
Checklist: