diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-05-24 12:25:50 +0300 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-05-24 13:26:34 +0100 |
commit | 9101fad30e1f0cbb1839fc5fb189761001857e8f (patch) | |
tree | d7489b95ad2a70a1b79906dc19706a74c8aa7704 | |
parent | c6ea6589bac4312501ff50bc157ddc8ee8c3dfdb (diff) | |
download | subplot-9101fad30e1f0cbb1839fc5fb189761001857e8f.tar.gz |
test: add test scenarios for mixing regex and simple patterns
-rw-r--r-- | subplot.md | 65 |
1 files changed, 65 insertions, 0 deletions
@@ -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 |