diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-02-15 10:40:55 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-02-15 10:40:55 +0000 |
commit | f997af392d33f557d779af8b71fc782c2f105b23 (patch) | |
tree | fa86fc7f920f991de5d9cf7698ca20790aef8ae5 /subplot.md | |
parent | 62df0717e7087a051ec697b59b21feefaa27ece7 (diff) | |
parent | 3383d2689be3ddbe4ff7609d0f5e655f4d82745b (diff) | |
download | subplot-f997af392d33f557d779af8b71fc782c2f105b23.tar.gz |
Merge branch 'liw/andbut' into 'master'
Add: add support for "and" and "but" keywords
See merge request larswirzenius/subplot!3
Diffstat (limited to 'subplot.md')
-rw-r--r-- | subplot.md | 59 |
1 files changed, 59 insertions, 0 deletions
@@ -503,8 +503,12 @@ then bar was done function: precond_foo - when: I do bar function: do_bar +- when: I do foobar + function: do_foobar - then: bar was done function: bar_was_done +- then: foobar was done + function: foobar_was_done ~~~ ### Python functions (f.py) @@ -512,10 +516,15 @@ then bar was done ~~~{.file #f.py .python .numberLines} def precond_foo(ctx): ctx['bar_done'] = False + ctx['foobar_done'] = False def do_bar(ctx): ctx['bar_done'] = True def bar_was_done(ctx): assert_eq(ctx['bar_done'], True) +def do_foobar(ctx): + ctx['foobar_done'] = True +def foobar_was_done(ctx): + assert_eq(ctx['foobar_done'], True) ~~~ @@ -544,6 +553,56 @@ then program finished successfully ~~~ +Keywords +----------------------------------------------------------------------------- + +Subplot supports the keywords **given**, **when**, and **then**, and +the aliases **and** and **but**. The aliases stand for the same +(effective) keyword as the previous step in the scenario. This chapter +has scenarios to check the keywords and aliases in various +combinations. + +### All the keywords + +~~~scenario +given file allkeywords.md +given file b.yaml +given file f.py +when I run sp-docgen allkeywords.md -o foo.pdf +then file foo.pdf exists +when I run sp-codegen --run allkeywords.md -o test.py +then scenario "All keywords" was run +then step "given precondition foo" was run +then step "when I do bar" was run +then step "then bar was done" was run +then program finished successfully +~~~ + +~~~{.file #allkeywords.md .markdown .numberLines} +--- +title: All the keywords scenario +bindings: b.yaml +functions: f.py +... + +# All keywords + +This uses all the keywords. + +```scenario +given precondition foo +when I do bar +and I do foobar +then bar was done +but foobar was done +``` +~~~ + + +### Repeated keywords + +### + Empty lines in scenarios ----------------------------------------------------------------------------- |