summaryrefslogtreecommitdiff
path: root/fable-arch.md
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2019-08-05 22:49:07 +0300
committerLars Wirzenius <liw@liw.fi>2019-08-05 22:49:07 +0300
commiteed0650d80d99c42be7943b9a653e22c35c52ce5 (patch)
tree127b0bf9d62c72698ddf6df1116f8a21d723cef5 /fable-arch.md
parent21a8688be3861fc82e224949c1881fcf0ff25142 (diff)
downloadfable-poc-eed0650d80d99c42be7943b9a653e22c35c52ce5.tar.gz
Add: three sketches for Fable acceptance tests
There are no implementations yet, this is just to start sketching out what the scenarios for Fable itself should be.
Diffstat (limited to 'fable-arch.md')
-rw-r--r--fable-arch.md120
1 files changed, 112 insertions, 8 deletions
diff --git a/fable-arch.md b/fable-arch.md
index 338f8f4..2f29edf 100644
--- a/fable-arch.md
+++ b/fable-arch.md
@@ -438,13 +438,13 @@ when I run ftt-codegen --run simple.md
then log file says scenario "Simple" was run
and log file says step "given precondition foo" was run
and log file says step "when I do bar" was run
-and log file says step "then bar was don" was run
+and log file says step "then bar was done" was run
and program finished successfully
```
### simple.md&mdash;markdown file
-~~~~{#simple.md}
+~~~~{#simple.md .markdown}
# Simple
This is the simplest possible test scenario
@@ -457,7 +457,7 @@ then bar was done
### simple.yaml&mdash;bindings file
-```{#simple.yaml}
+```{#simple.yaml .yaml}
- given: precondition foo
function: precond
- when: I do bar
@@ -468,19 +468,123 @@ then bar was done
### simple.py&mdash;Python file with functions
-```{#simple.py}
+```{#simple.py .python}
+state = {'done': False}
def precond(ctx):
pass
def do(ctx):
- pass
+ state['done'] = True
def was_done(ctx):
- pass
+ assert state['done']
```
## Two scenarios in the same markdown file
-FIXME.
+This tests that Fable can run two successful scenarios in the same
+Markdown file successfully.
+
+```fable
+given files two.md, two.yaml, and two.py
+when I run ftt-codegen --run two.md
+then log file says scenario "First" was run
+and log file says step "given precondition foo" was run
+and log file says step "when I do bar" was run
+and log file says step "then bar was done" was run
+then log file says scenario "Second" was run
+and log file says step "given precondition foo" was run
+and log file says step "when I do bar" was run
+and log file says step "then bar was done" was run
+and program finished successfully
+```
+
+### two.md&mdash;markdown file
+
+~~~~{#two.md .markdown}
+# First
+This is the simplest possible test scenario
+
+```fable
+given precondition foo
+when I do bar
+then bar was done
+```
+
+# Second
+This is another scenario.
+
+```fable
+given precondition foo
+when I do bar
+then bar was done
+```
+~~~~
+
+### two.yaml&mdash;bindings file
+
+```{#two.yaml .yaml}
+- given: precondition foo
+ function: precond
+- when: I do bar
+ function: do
+- then: bar was done
+ function: was_done
+```
+
+### two.md&mdash;Python file with functions
+
+```{#two.py .python}
+state = {'done': False}
+def precond(ctx):
+ pass
+def do(ctx):
+ state['done'] = True
+def was_done(ctx):
+ assert state['done']
+```
## A scenario step fails
-FIXME.
+This tests that Fable can run handle a scenario step failing.
+
+```fable
+given files fail.md, fail.yaml, and fail.py
+when I run ftt-codegen --run fail.md
+then log file says scenario "Fail" was run
+and log file says step "given precondition foo" was run
+and log file says step "then bar was done" failed
+and program finished with an error
+```
+
+### fail.md&mdash;markdown file
+
+~~~~{#fail.md .markdown}
+# Fail
+This is a scenario that fails.
+
+```fable
+given precondition foo
+then bar was done
+```
+~~~~
+
+### fail.md&mdash;bindings file
+
+```{#fail.yaml .yaml}
+- given: precondition foo
+ function: precond
+- then: bar was done
+ function: was_done
+```
+
+### fail.md&mdash;Python file with functions
+
+```{#fail.py .python}
+state = {'done': False}
+def precond(ctx):
+ pass
+def do(ctx):
+ state['done'] = True
+def was_done(ctx):
+ assert state['done']
+```
+