diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-11-07 10:35:48 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-24 12:23:35 +0300 |
commit | 85ed36991c37ddce75b66d3b8af8385311e7fb99 (patch) | |
tree | 8bc76fe7d10d08797ab1a4aff452d5c715ef8838 | |
parent | 359cd592463a8d33af02b02c7069918102b72ec6 (diff) | |
download | subplot-85ed36991c37ddce75b66d3b8af8385311e7fb99.tar.gz |
test: add subplot for testing Subplot against a curated list
-rw-r--r-- | reference.md | 61 | ||||
-rw-r--r-- | reference.py | 17 | ||||
-rw-r--r-- | reference.yaml | 5 |
3 files changed, 83 insertions, 0 deletions
diff --git a/reference.md b/reference.md new file mode 100644 index 0000000..f6620c8 --- /dev/null +++ b/reference.md @@ -0,0 +1,61 @@ +# Introduction + +This document describes how we guard against accidental breaking +changes in Subplot by running it against a curated set of subplot +documents. + +# Subplot + +## Produce a PDF + +~~~scenario +given an installed subplot +given a clone of https://gitlab.com/larswirzenius/subplot.git in src at ec9652a72aa8ff47fa64b8a1b5ba9afe84be4f7e +when I docgen subplot.md to test.pdf, in src +then file src/test.pdf exists +~~~ + +## Produce HTML page + +~~~scenario +given an installed subplot +given a clone of https://gitlab.com/larswirzenius/subplot.git in src at ec9652a72aa8ff47fa64b8a1b5ba9afe84be4f7e +when I docgen subplot.md to test.html, in src +when I run, in src, subplot docgen subplot.md -o subplot.html +then file src/test.html exists +~~~ + +## Generate and run test program + +~~~scenario +given an installed subplot +given file run_test.sh +given a clone of https://gitlab.com/larswirzenius/subplot.git in src at ec9652a72aa8ff47fa64b8a1b5ba9afe84be4f7e +when I run, in src, subplot codegen subplot.md -o test-inner.py +when I run bash run_test.sh +then command is successful +~~~ + +~~~{#run_test.sh .file .sh} +#!/bin/bash + +set -euo pipefail +python3 src/test-inner.py --log test-inner.log --env "SUBPLOT_DIR=$(pwd)/target/debug" +~~~ + + +--- +title: Test Subplot against reference subplots +author: The Subplot project +template: python +bindings: +- reference.yaml +- subplot.yaml +- lib/runcmd.yaml +- lib/files.yaml +functions: +- reference.py +- subplot.py +- lib/files.py +- lib/runcmd.py +... diff --git a/reference.py b/reference.py new file mode 100644 index 0000000..69ad466 --- /dev/null +++ b/reference.py @@ -0,0 +1,17 @@ +def clone_to_src(ctx, url=None, commit=None): + runcmd_run = globals()["runcmd_run"] + runcmd_exit_code_is_zero = globals()["runcmd_exit_code_is_zero"] + + runcmd_run(ctx, ["git", "clone", url, "src"]) + runcmd_exit_code_is_zero(ctx) + + runcmd_run(ctx, ["git", "checkout", commit], cwd="src") + runcmd_exit_code_is_zero(ctx) + + +def docgen(ctx, filename=None, output=None, dirname=None): + runcmd_run = globals()["runcmd_run"] + runcmd_exit_code_is_zero = globals()["runcmd_exit_code_is_zero"] + + runcmd_run(ctx, ["subplot", "docgen", filename, "--output", output], cwd=dirname) + runcmd_exit_code_is_zero(ctx) diff --git a/reference.yaml b/reference.yaml new file mode 100644 index 0000000..2f1573c --- /dev/null +++ b/reference.yaml @@ -0,0 +1,5 @@ +- given: "a clone of {url} in src at {commit}" + function: clone_to_src + +- when: "I docgen {filename} to {output}, in {dirname}" + function: docgen |