File tree 2 files changed +24
-1
lines changed
lib/cucumber/core/gherkin
spec/cucumber/core/test/filters
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -373,6 +373,12 @@ def result
373
373
def rows
374
374
attributes [ :rows ] = attributes [ :rows ] . map { |r | r [ :cells ] . map { |c | c [ :value ] } }
375
375
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
376
382
end
377
383
378
384
class DocStringBuilder < Builder
Original file line number Diff line number Diff line change @@ -96,6 +96,8 @@ module Cucumber::Core
96
96
Given a table
97
97
| a | b |
98
98
| 1 | 2 |
99
+ | 3 | 4 |
100
+
99
101
END
100
102
end
101
103
@@ -192,10 +194,25 @@ def test_case_named(name)
192
194
test_cases . find { |c | c . name == 'with a table' }
193
195
end
194
196
195
- it "matches a location on the first table row " do
197
+ it "matches a location at the start of the table " do
196
198
location = Ast ::Location . new ( file , 23 )
197
199
expect ( test_case . match_locations? ( [ location ] ) ) . to be_truthy
198
200
end
201
+
202
+ it "matches a location in the middle of the table" do
203
+ location = Ast ::Location . new ( file , 24 )
204
+ expect ( test_case . match_locations? ( [ location ] ) ) . to be_truthy
205
+ end
206
+
207
+ it "matches a location at the end of the table" do
208
+ location = Ast ::Location . new ( file , 25 )
209
+ expect ( test_case . match_locations? ( [ location ] ) ) . to be_truthy
210
+ end
211
+
212
+ it "does not match a location after the table" do
213
+ location = Ast ::Location . new ( file , 26 )
214
+ expect ( test_case . match_locations? ( [ location ] ) ) . to be_falsey
215
+ end
199
216
end
200
217
201
218
context "with duplicate locations in the filter" do
You can’t perform that action at this time.
0 commit comments