commit 4ce92416beb93921086fa8488ba02da2227a4101
parent 2cf0679dded121c834a95a1b67f7d5a94b670ed6
Author: Richard Ipsum <richardipsum@vx21.xyz>
Date:   Sat, 23 Nov 2019 16:59:44 +0000
Add `...` continuations
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/tyarn.in b/tyarn.in
@@ -138,6 +138,17 @@ function parse_scenario_line(scenario, scenario_name, steps_seen,
         last_step_type = "FINALLY"
         steps_seen["FINALLY"] = true
         table.insert(scenario["FINALLY"], normalise_scenario_line(stripped_line, "FINALLY"))
+    elseif tyarn.re_match(line, "^(    )[ \t]*\\.\\.\\.") then
+        if last_step_type == nil then
+            io.stderr:write(string.format(
+                'Scenario "%s" (line %d) has ... as first step: %s\n',
+                scenario_name, line_no, stripped_line))
+            os.exit(1)
+        end
+
+
+        -- continuation of previous scenario line
+        scenario[#scenario] = scenario[#scenario] .. ' ' .. lstrip(string.gsub(stripped_line, '^...', '', 1))
     end
 
     return last_step_type