summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--subplot.md65
1 files changed, 65 insertions, 0 deletions
diff --git a/subplot.md b/subplot.md
index 74e23cf..f16c6fe 100644
--- a/subplot.md
+++ b/subplot.md
@@ -919,6 +919,71 @@ def func(ctx, name=None):
print('function got argument name as', name)
~~~
+### Simple patterns with regex metacharacters: forbidden case
+
+Help use to avoid accidental regular expression versus simple pattern
+confusion. The rule is that a simple pattern mustn't contain regular
+expression meta characters unless the rule is explicitly marked as not
+being a regular expression pattern.
+
+~~~scenario
+given file confusedpattern.md
+and file confusedpattern.yaml
+and file capture.py
+when I try to run sp-codegen --run confusedpattern.md -o test.py
+then exit code is non-zero
+and stderr matches /simple pattern contains regex/
+~~~
+
+~~~~{#confusedpattern.md .file .markdown .numberLines}
+---
+title: Simple pattern capture
+bindings: confusedpattern.yaml
+functions: capture.py
+...
+
+# Simple pattern
+
+~~~scenario
+given I* am Tomjon
+~~~
+~~~~
+
+~~~{#confusedpattern.yaml .file .yaml .numberLines}
+- given: I* am {name}
+ function: func
+~~~
+
+### Simple patterns with regex metacharacters: allowed case
+
+~~~scenario
+given file confusedbutok.md
+and file confusedbutok.yaml
+and file capture.py
+when I run sp-codegen --run confusedbutok.md -o test.py
+then program finished successfully
+~~~
+
+~~~~{#confusedbutok.md .file .markdown .numberLines}
+---
+title: Simple pattern capture
+bindings: confusedbutok.yaml
+functions: capture.py
+...
+
+# Simple pattern
+
+~~~scenario
+given I* am Tomjon
+~~~
+~~~~
+
+~~~{#confusedbutok.yaml .file .yaml .numberLines}
+- given: I* am {name}
+ function: func
+ regex: false
+~~~
+
### Capture using regular expressions
~~~scenario