diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2021-01-10 12:01:27 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2021-01-10 12:01:27 +0000 |
commit | 115f5897c02d26d4101658c2a34e116940d1fb6f (patch) | |
tree | 99a028f400d625a8892105b957f033159c9a7520 /share | |
parent | fc5723769e68e46c370b1050cc2b8faa5e79d9b4 (diff) | |
download | subplot-115f5897c02d26d4101658c2a34e116940d1fb6f.tar.gz |
subplotlib: Move steplibrary into share tree
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'share')
-rw-r--r-- | share/rust/lib/datadir.yaml | 13 | ||||
-rw-r--r-- | share/rust/lib/files.yaml | 68 | ||||
-rw-r--r-- | share/rust/lib/runcmd.yaml | 89 |
3 files changed, 170 insertions, 0 deletions
diff --git a/share/rust/lib/datadir.yaml b/share/rust/lib/datadir.yaml new file mode 100644 index 0000000..acd4ad4 --- /dev/null +++ b/share/rust/lib/datadir.yaml @@ -0,0 +1,13 @@ +# Bindings for the datadir steps +# These steps are pretty simplistic since Datadir is mostly +# a utility context for use by other step libraries, however some +# of the capabilities are worth exporting as steps + +- given: datadir has at least {bytes}B of space + function: subplotlib::steplibrary::datadir::datadir_has_enough_space + types: + bytes: uint +- given: datadir has at least {megabytes}M of space + function: subplotlib::steplibrary::datadir::datadir_has_enough_space_megabytes + types: + megabytes: uint diff --git a/share/rust/lib/files.yaml b/share/rust/lib/files.yaml new file mode 100644 index 0000000..339e7cf --- /dev/null +++ b/share/rust/lib/files.yaml @@ -0,0 +1,68 @@ +# Bindings for the files steps +# These bind the files step library for subplotlib + +- given: file {embedded_file} + function: subplotlib::steplibrary::files::create_from_embedded + types: + embedded_file: file + +- given: file {filename_on_disk} from {embedded_file} + function: subplotlib::steplibrary::files::create_from_embedded_with_other_name + types: + embedded_file: file + +- given: file (?P<filename>\S+) has modification time (?P<mtime>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) + regex: true + function: subplotlib::steplibrary::files::touch_with_timestamp + types: + mtime: text + +- when: I write "(?P<text>.*)" to file (?P<filename>\S+) + regex: true + function: subplotlib::steplibrary::files::create_from_text + +- when: I remember metadata for file {filename} + function: subplotlib::steplibrary::files::remember_metadata + +- when: I touch file {filename} + function: subplotlib::steplibrary::files::touch + +- then: file {filename} exists + function: subplotlib::steplibrary::files::file_exists + +- then: file {filename} does not exist + function: subplotlib::steplibrary::files::file_does_not_exist + +- then: only files (?P<filenames>.+) exist + function: subplotlib::steplibrary::files::only_these_exist + regex: true + +- then: file (?P<filename>\S+) contains "(?P<data>.*)" + regex: true + function: subplotlib::steplibrary::files::file_contains + +- then: file (?P<filename>\S+) matches regex /(?P<regex>.*)/ + regex: true + function: subplotlib::steplibrary::files::file_matches_regex + +- then: file (?P<filename>\S+) matches regex "(?P<regex>.*)" + regex: true + function: subplotlib::steplibrary::files::file_matches_regex + +- then: files {filename1} and {filename2} match + function: subplotlib::steplibrary::files::file_match + +- then: file {filename} has same metadata as before + function: subplotlib::steplibrary::files::has_remembered_metadata + +- then: file {filename} has different metadata from before + function: subplotlib::steplibrary::files::has_different_metadata + +- then: file {filename} has changed from before + function: subplotlib::steplibrary::files::has_different_metadata + +- then: file {filename} has a very recent modification time + function: subplotlib::steplibrary::files::mtime_is_recent + +- then: file {filename} has a very old modification time + function: subplotlib::steplibrary::files::mtime_is_ancient diff --git a/share/rust/lib/runcmd.yaml b/share/rust/lib/runcmd.yaml new file mode 100644 index 0000000..0a635c9 --- /dev/null +++ b/share/rust/lib/runcmd.yaml @@ -0,0 +1,89 @@ +# Bindings for the runcmd steplibrary + +- given: helper script {script} for runcmd + function: subplotlib::steplibrary::runcmd::helper_script + types: + script: file + +- given: srcdir is in the PATH + function: subplotlib::steplibrary::runcmd::helper_srcdir_path + +- when: I run (?P<argv0>\S+)(?P<args>.*) + regex: true + function: subplotlib::steplibrary::runcmd::run + +- when: I try to run (?P<argv0>\S+)(?P<args>.*) + regex: true + function: subplotlib::steplibrary::runcmd::try_to_run + +# Steps to examine exit code of latest command. + +- then: exit code is {exit} + function: subplotlib::steplibrary::runcmd::exit_code_is + types: + exit: int + +- then: exit code is not {exit} + function: subplotlib::steplibrary::runcmd::exit_code_is_not + types: + exit: int + +- then: command is successful + function: subplotlib::steplibrary::runcmd::exit_code_is_zero + +- then: command fails + function: subplotlib::steplibrary::runcmd::exit_code_is_nonzero + +# Steps to examine stdout/stderr for exact content. + +- then: stdout is exactly "(?P<text>.*)" + regex: true + function: subplotlib::steplibrary::runcmd::stdout_is + +- then: 'stdout isn''t exactly "(?P<text>.*)"' + regex: true + function: subplotlib::steplibrary::runcmd::stdout_isnt + +- then: stderr is exactly "(?P<text>.*)" + regex: true + function: subplotlib::steplibrary::runcmd::stderr_is + +- then: 'stderr isn''t exactly "(?P<text>.*)"' + regex: true + function: subplotlib::steplibrary::runcmd::stderr_isnt + +# Steps to examine stdout/stderr for sub-strings. + +- then: stdout contains "(?P<text>.*)" + regex: true + function: subplotlib::steplibrary::runcmd::stdout_contains + +- then: 'stdout doesn''t contain "(?P<text>.*)"' + regex: true + function: subplotlib::steplibrary::runcmd::stdout_doesnt_contain + +- then: stderr contains "(?P<text>.*)" + regex: true + function: subplotlib::steplibrary::runcmd::stderr_contains + +- then: 'stderr doesn''t contain "(?P<text>.*)"' + regex: true + function: subplotlib::steplibrary::runcmd::stderr_doesnt_contain + +# Steps to match stdout/stderr against regular expressions. + +- then: stdout matches regex (?P<regex>.*) + regex: true + function: subplotlib::steplibrary::runcmd::stdout_matches_regex + +- then: stdout doesn't match regex (?P<regex>.*) + regex: true + function: subplotlib::steplibrary::runcmd::stdout_doesnt_match_regex + +- then: stderr matches regex (?P<regex>.*) + regex: true + function: subplotlib::steplibrary::runcmd::stderr_matches_regex + +- then: stderr doesn't match regex (?P<regex>.*) + regex: true + function: subplotlib::steplibrary::runcmd::stderr_doesnt_match_regex |