diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2022-01-01 12:03:51 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2022-01-01 14:05:30 +0000 |
commit | 95b3d27d27a8dab7cb8a5136000a2331ab9b4a4a (patch) | |
tree | 632bb651f7bb70152bacfcccc268ccffd5e64c0d /subplotlib | |
parent | d4856f7b04b5f58118e518fd2a3413363dcad6ce (diff) | |
download | subplot-95b3d27d27a8dab7cb8a5136000a2331ab9b4a4a.tar.gz |
tests: Move files.md to be common between Python and subplotlib
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'subplotlib')
-rw-r--r-- | subplotlib/build.rs | 2 | ||||
-rw-r--r-- | subplotlib/files.md | 102 |
2 files changed, 2 insertions, 102 deletions
diff --git a/subplotlib/build.rs b/subplotlib/build.rs index a809a68..d1eeefd 100644 --- a/subplotlib/build.rs +++ b/subplotlib/build.rs @@ -18,6 +18,8 @@ fn main() { let subplots = glob("*.md").expect("failed to find subplots in subplotlib"); let tests = Path::new("tests"); let subplots = subplots.chain(Some(Ok("../subplot.md".into()))); + let subplots = subplots + .chain(glob("../tests/subplots/common/*.md").expect("failed to find common subplots")); for entry in subplots { let entry = entry.expect("failed to get subplot dir entry in subplotlib"); let mut inc = tests.join(&entry.file_name().unwrap()); diff --git a/subplotlib/files.md b/subplotlib/files.md deleted file mode 100644 index 22e8f3c..0000000 --- a/subplotlib/files.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: Acceptance criteria for the files subplotlib step library -author: The Subplot project -bindings: - - lib/files.yaml -impls: - rust: [] -... - -# Introduction - -The [Subplot][] library `files` provides scenario steps and their -implementations for managing files on the file system during tests. -The library consists of a bindings file `subplotlib/steplibrary/files.yaml` and -implementations in Rust as part of `subplotlib`. - -[subplot]: https://subplot.liw.fi/ - -This document explains the acceptance criteria for the library and how -they're verified. It uses the steps and functions from the `files` -step library. - -# Create on-disk files from embedded files - -Subplot allows the source document to embed test files, and the -`files` library provides steps to create real, on-disk files from -the embedded files. - -```scenario -given file hello.txt -then file hello.txt exists -and file hello.txt contains "hello, world" -and file other.txt does not exist -given file other.txt from hello.txt -then file other.txt exists -and files hello.txt and other.txt match -and only files hello.txt, other.txt exist -``` - -```{#hello.txt .file .numberLines} -hello, world -``` - -# File metadata - -These steps create files and manage their metadata. - -```scenario -given file hello.txt -when I remember metadata for file hello.txt -then file hello.txt has same metadata as before - -when I write "yo" to file hello.txt -then file hello.txt has different metadata from before -``` - -# File modification time - -These steps manipulate and test file modification times. - -```scenario -given file foo.dat has modification time 1970-01-02 03:04:05 -then file foo.dat has a very old modification time - -when I touch file foo.dat -then file foo.dat has a very recent modification time -``` - -# File contents - -These steps verify contents of files. - -```scenario -given file hello.txt -then file hello.txt contains "hello, world" -and file hello.txt matches regex "hello, .*" -and file hello.txt matches regex /hello, .*/ -``` - -# Directories - -There are also a large number of directory based steps and some directory -based behaviour available in creating files which are available in the files -library. - -```scenario -given a directory first -then directory first exists -and directory first is empty -and directory second does not exist -when I remove directory first -then directory first does not exist -when I create directory second -then directory second exists -and directory second is empty -given file second/third/hello.txt from hello.txt -then directory second is not empty -and directory second/third exists -and directory second/third is not empty -when I remove directory second -then directory second does not exist -``` |