File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
lib/cucumber/core/gherkin
spec/cucumber/core/test/filters Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -373,6 +373,12 @@ def result
373373 def rows
374374 attributes [ :rows ] = attributes [ :rows ] . map { |r | r [ :cells ] . map { |c | c [ :value ] } }
375375 end
376+
377+ def location
378+ first_line = attributes [ :location ] [ :line ]
379+ last_line = first_line + attributes [ :rows ] . length - 1
380+ Ast ::Location . new ( file , first_line ..last_line )
381+ end
376382 end
377383
378384 class DocStringBuilder < Builder
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ module Cucumber::Core
9696 Given a table
9797 | a | b |
9898 | 1 | 2 |
99+ | 3 | 4 |
99100
100101 Scenario: empty
101102 END
@@ -201,10 +202,25 @@ def test_case_named(name)
201202 test_cases . find { |c | c . name == 'with a table' }
202203 end
203204
204- it "matches a location on the first table row " do
205+ it "matches a location at the start of the table " do
205206 location = Ast ::Location . new ( file , 23 )
206207 expect ( test_case . match_locations? ( [ location ] ) ) . to be_truthy
207208 end
209+
210+ it "matches a location in the middle of the table" do
211+ location = Ast ::Location . new ( file , 24 )
212+ expect ( test_case . match_locations? ( [ location ] ) ) . to be_truthy
213+ end
214+
215+ it "matches a location at the end of the table" do
216+ location = Ast ::Location . new ( file , 25 )
217+ expect ( test_case . match_locations? ( [ location ] ) ) . to be_truthy
218+ end
219+
220+ it "does not match a location after the table" do
221+ location = Ast ::Location . new ( file , 26 )
222+ expect ( test_case . match_locations? ( [ location ] ) ) . to be_falsey
223+ end
208224 end
209225
210226 context "with duplicate locations in the filter" do
You can’t perform that action at this time.
0 commit comments