Skip to content

Commit 71032ba

Browse files
committed
Fixed couple of cases for scenario outlines
* Support empty lines after `Examples:` keyword * Support multiple `Examples:` sections for one scenario outline
1 parent 9b04f93 commit 71032ba

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/practitest_firecracker/parser/gherkin.clj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
(:map param)] result]]))
5959
all-params)))
6060

61+
(defn- examples-section-end? [line]
62+
(str/starts-with? (str/lower-case (str/trim line)) "scenario:"))
63+
6164
;; TODO: tags support ??
6265
(defn- extract-scenario-source
6366
[feature-root scenario]
@@ -73,13 +76,13 @@
7376

7477
outline?
7578
;; For outline need to extract examples as well
76-
(let [start-examples (:line (:location (last (:examples scenario))))]
77-
;; Find end of examples sections - either end of file or empty line
79+
(let [start-examples (:line (:location (first (:examples scenario))))]
80+
;; Find end of examples sections - either end of file or new BDD scenario
7881
(loop [i start-examples
7982
coll (seq (drop start-examples feature-source))]
8083
(if coll
8184
(let [line (first coll)]
82-
(if (str/blank? line)
85+
(if (examples-section-end? line)
8386
i
8487
(recur (inc i) (next coll))))
8588
i)))

test/gherkin/identity.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ Feature: Identity feature
88
Then I will get result <result> every time
99

1010
Examples:
11+
1112
| arg | result |
1213
| "First Item" | "First Item" |
1314
| "Second Item" | "Second 123" |
1415
| "Third Item" | "Third Item" |
16+
17+
Examples:
18+
19+
| arg | result |
20+
| "Second Part" | "Second Part" |
21+
| "Failure" | "That would fail" |
22+
23+
Scenario: Another schenario just in case

0 commit comments

Comments
 (0)