diff options
author | Daniel Silverstone <dsilvers+gitlab@digital-scurf.org> | 2021-10-28 08:24:47 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers+gitlab@digital-scurf.org> | 2021-10-28 08:24:47 +0000 |
commit | a459103c0e54136b0c5d3d9385962b3a46c2d377 (patch) | |
tree | 0e819ad111d4c1692546b4bbcee7780fa326685f | |
parent | a652f1995a81ccb3846f014b7a6de8a2358d1695 (diff) | |
parent | 5321180f75f69ce2699b6299488576feb6a60499 (diff) | |
download | subplot-a459103c0e54136b0c5d3d9385962b3a46c2d377.tar.gz |
Merge branch 'simple-patterns' into 'main'
refactor: use simple patterns where possible
Closes #188
See merge request subplot/subplot!228
-rw-r--r-- | examples/echo/echo.yaml | 9 | ||||
-rw-r--r-- | examples/muck/muck.yaml | 3 | ||||
-rw-r--r-- | share/common/lib/runcmd.yaml | 48 | ||||
-rw-r--r-- | subplot.yaml | 6 |
4 files changed, 22 insertions, 44 deletions
diff --git a/examples/echo/echo.yaml b/examples/echo/echo.yaml index bcbdf87..d68a32f 100644 --- a/examples/echo/echo.yaml +++ b/examples/echo/echo.yaml @@ -3,28 +3,25 @@ bash: function: run_echo_without_args -- when: user runs echo with arguments (?P<args>.+) +- when: user runs echo with arguments {args:text} impl: bash: function: run_echo_with_args - regex: true -- then: exit code is (?P<exit_code>\d+) +- then: exit code is {exit_code:uint} impl: bash: function: exit_code_is - regex: true - then: standard output contains a newline impl: bash: function: stdout_is_a_newline -- then: standard output contains "(?P<text>.*)" +- then: standard output contains "{text:text}" impl: bash: function: stdout_is_text - regex: true - then: standard error is empty impl: diff --git a/examples/muck/muck.yaml b/examples/muck/muck.yaml index 10f67ee..b22e088 100644 --- a/examples/muck/muck.yaml +++ b/examples/muck/muck.yaml @@ -43,11 +43,10 @@ function: fixme regex: true -- then: "response code is (?P<code>\\d+)" +- then: "response code is {code:uint}" impl: python: function: fixme - regex: true - then: "header {header} is {name}" impl: diff --git a/share/common/lib/runcmd.yaml b/share/common/lib/runcmd.yaml index bde2f69..5847613 100644 --- a/share/common/lib/runcmd.yaml +++ b/share/common/lib/runcmd.yaml @@ -16,32 +16,28 @@ rust: function: subplotlib::steplibrary::runcmd::helper_srcdir_path -- when: I run (?P<argv0>\S+)(?P<args>.*) - regex: true +- when: I run {argv0}{args:text} impl: python: function: runcmd_step rust: function: subplotlib::steplibrary::runcmd::run -- when: I run, in (?P<dirname>\S+), (?P<argv0>\S+)(?P<args>.*) - regex: true +- when: I run, in {dirname}, {argv0}{args:text} impl: python: function: runcmd_step_in rust: function: subplotlib::steplibrary::runcmd::run_in -- when: I try to run (?P<argv0>\S+)(?P<args>.*) - regex: true +- when: I try to run {argv0}{args:text} impl: python: function: runcmd_try_to_run rust: function: subplotlib::steplibrary::runcmd::try_to_run -- when: I try to run, in (?P<dirname>\S+), (?P<argv0>\S+)(?P<args>.*) - regex: true +- when: I try to run, in {dirname}, {argv0}{args:text} impl: python: function: runcmd_try_to_run_in @@ -84,32 +80,28 @@ # Steps to examine stdout/stderr for exact content. -- then: stdout is exactly "(?P<text>.*)" - regex: true +- then: stdout is exactly "{text:text}" impl: python: function: runcmd_stdout_is rust: function: subplotlib::steplibrary::runcmd::stdout_is -- then: 'stdout isn''t exactly "(?P<text>.*)"' - regex: true +- then: 'stdout isn''t exactly "{text:text}"' impl: python: function: runcmd_stdout_isnt rust: function: subplotlib::steplibrary::runcmd::stdout_isnt -- then: stderr is exactly "(?P<text>.*)" - regex: true +- then: stderr is exactly "{text:text}" impl: python: function: runcmd_stderr_is rust: function: subplotlib::steplibrary::runcmd::stderr_is -- then: 'stderr isn''t exactly "(?P<text>.*)"' - regex: true +- then: 'stderr isn''t exactly "{text:text}"' impl: python: function: runcmd_stderr_isnt @@ -118,32 +110,28 @@ # Steps to examine stdout/stderr for sub-strings. -- then: stdout contains "(?P<text>.*)" - regex: true +- then: stdout contains "{text:text}" impl: python: function: runcmd_stdout_contains rust: function: subplotlib::steplibrary::runcmd::stdout_contains -- then: 'stdout doesn''t contain "(?P<text>.*)"' - regex: true +- then: 'stdout doesn''t contain "{text:text}"' impl: python: function: runcmd_stdout_doesnt_contain rust: function: subplotlib::steplibrary::runcmd::stdout_doesnt_contain -- then: stderr contains "(?P<text>.*)" - regex: true +- then: stderr contains "{text:text}" impl: python: function: runcmd_stderr_contains rust: function: subplotlib::steplibrary::runcmd::stderr_contains -- then: 'stderr doesn''t contain "(?P<text>.*)"' - regex: true +- then: 'stderr doesn''t contain "{text:text}"' impl: python: function: runcmd_stderr_doesnt_contain @@ -152,32 +140,28 @@ # Steps to match stdout/stderr against regular expressions. -- then: stdout matches regex (?P<regex>.*) - regex: true +- then: stdout matches regex {regex:text} impl: python: function: runcmd_stdout_matches_regex rust: function: subplotlib::steplibrary::runcmd::stdout_matches_regex -- then: stdout doesn't match regex (?P<regex>.*) - regex: true +- then: stdout doesn't match regex {regex:text} impl: python: function: runcmd_stdout_doesnt_match_regex rust: function: subplotlib::steplibrary::runcmd::stdout_doesnt_match_regex -- then: stderr matches regex (?P<regex>.*) - regex: true +- then: stderr matches regex {regex:text} impl: python: function: runcmd_stderr_matches_regex rust: function: subplotlib::steplibrary::runcmd::stderr_matches_regex -- then: stderr doesn't match regex (?P<regex>.*) - regex: true +- then: stderr doesn't match regex {regex:text} impl: python: function: runcmd_stderr_doesnt_match_regex diff --git a/subplot.yaml b/subplot.yaml index 229cc7d..b865d83 100644 --- a/subplot.yaml +++ b/subplot.yaml @@ -4,17 +4,15 @@ function: install_subplot cleanup: uninstall_subplot -- then: scenario "(?P<name>.+)" was run +- then: scenario "{name:text}" was run impl: python: function: scenario_was_run - regex: true -- then: scenario "(?P<name>.+)" was not run +- then: scenario "{name:text}" was not run impl: python: function: scenario_was_not_run - regex: true - then: step "(?P<keyword>given|when|then) (?P<name>.+)" was run impl: |