summaryrefslogtreecommitdiff
path: root/files.yaml
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-05-20 10:14:00 +0300
committerLars Wirzenius <liw@liw.fi>2020-05-20 10:59:54 +0300
commit0a073fa0b2a7e456d3bff9c9bfe930e8b3ee7449 (patch)
treeec50e222e1c9b139d08a0eae6911cbe87e0fb485 /files.yaml
parent6ca305d000360de74e686d801c638086c876d08a (diff)
downloadsubplot-0a073fa0b2a7e456d3bff9c9bfe930e8b3ee7449.tar.gz
refactor: move things from subplot.{py,yaml} to separate files
files.{py,yaml} contain re-usable steps for handling files. runcmd.{py,yaml} contain re-usable steps for running commands and inspecting results.
Diffstat (limited to 'files.yaml')
-rw-r--r--files.yaml36
1 files changed, 36 insertions, 0 deletions
diff --git a/files.yaml b/files.yaml
new file mode 100644
index 0000000..2cc53e1
--- /dev/null
+++ b/files.yaml
@@ -0,0 +1,36 @@
+- given: file {filename}
+ function: create_file
+
+- given: file (?P<filename>\S+) has modification time (?P<y>\d+)-(?P<mon>\d+)-(?P<d>\d+) (?P<h>\d+):(?P<min>\d+):(?P<s>\d+)
+ function: touch_file
+ regex: true
+
+- when: I remember the metadata for {filename}
+ function: remember_metadata
+
+- when: I touch {filename}
+ function: update_mtime
+
+- then: file {filename} exists
+ function: file_exists
+
+- then: file {filename} does not exist
+ function: file_does_not_exist
+
+- then: file (?P<filename>\S+) matches /(?P<regex>.+)/
+ function: file_matches
+ regex: true
+
+- then: file (?P<filename>\S+) contains "(?P<pattern>.+)"
+ function: file_contains
+ regex: true
+
+- then: "{filename} has the same metadata as before"
+ function: has_same_metadata_as_remembered
+
+- then: "{filename} has changed from before"
+ function: has_diff_metadata_than_remembered
+
+- then: only files (?P<filenames>.+) exist
+ function: only_these_files_exist
+ regex: true