summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-06-06 15:52:59 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-06-07 08:42:12 +0100
commit8f73d4a5a1c48dbf1b2a75a6a01ee37b28381e9e (patch)
tree6b74a55f561688fb2a8f181fa727660957d154c6
parentbf285b4252064e724741e770cc2822a7a33b90ad (diff)
downloadsubplot-8f73d4a5a1c48dbf1b2a75a6a01ee37b28381e9e.tar.gz
test: Add no-binding and multiple-binding check scenarios
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
-rw-r--r--subplot.md60
1 files changed, 60 insertions, 0 deletions
diff --git a/subplot.md b/subplot.md
index b2cdecf..b99f397 100644
--- a/subplot.md
+++ b/subplot.md
@@ -1811,6 +1811,66 @@ This is another embedded file, and has the same name in uppercase.
```
~~~~
+## Steps must match bindings
+
+Subplot permits the binding author to define arbitrarily complex regular
+expressions for binding matches. In order to ensure that associating steps
+to bindings is both reliable and tractable, a step must match _exactly one_
+binding.
+
+```{#badbindings.yaml .file .yaml}
+- given: a binding
+ function: a_binding
+- given: a (?:broken)? binding
+ function: a_broken_binding
+ regex: true
+```
+
+### Steps which do not match bindings do not work
+
+~~~~{#nobinding.md .file .markdown}
+---
+title: No bindings available
+bindings:
+- badbindings.yaml
+...
+# Broken scenario because step has no binding
+
+```scenario
+given a missing binding
+then nothing works
+```
+~~~~
+
+```scenario
+given file nobinding.md
+and file badbindings.yaml
+when I try to run sp-codegen --run nobinding.md -o test.py
+then exit code is non-zero
+```
+
+### Steps which match more than one binding do not work
+
+~~~~{#twobindings.md .file .markdown}
+---
+title: Two bindings match
+bindings:
+- badbindings.yaml
+...
+# Broken scenario because step has two possible bindings
+
+```scenario
+given a binding
+```
+~~~~
+
+```scenario
+given file twobindings.md
+and file badbindings.yaml
+when I try to run sp-codegen --run twobindings.md -o test.py
+then exit code is non-zero
+```
+
## Embedded graphs