summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-12-05 09:40:17 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-12-21 08:39:32 +0000
commit384f1fa8a20f29f7a72f5591c36a2b41caf9822c (patch)
treea8ac1534cd2094938073441f5d2f2c17dd0c9fc4 /check
parent2553dd8d3db3f00a94cfd19d8f2c6c76bf1e6a2c (diff)
downloadsubplot-384f1fa8a20f29f7a72f5591c36a2b41caf9822c.tar.gz
check: Check subplotlib
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'check')
-rwxr-xr-xcheck27
1 files changed, 24 insertions, 3 deletions
diff --git a/check b/check
index 10c0303..efb7195 100755
--- a/check
+++ b/check
@@ -24,10 +24,15 @@ then
hideok=
fi
+TOPDIR=$(pwd)
+
+_codegen() {
+ $hideok cargo run $quiet --package subplot --bin sp-codegen -- \
+ "$1" --output "$2" --templates "${TOPDIR}/templates"
+}
codegen() {
- $hideok cargo run $quiet --bin sp-codegen -- \
- "$1" --output "$2" --templates "$(pwd)/templates"
+ _codegen "$1" "$2"
rm -f test.log
template="$(sed -n '/^template: /s///p' "$1" | tail -n1)"
case "$template" in
@@ -38,7 +43,7 @@ codegen() {
}
docgen() {
- cargo run $quiet --bin sp-docgen -- "$1" --output "$2"
+ cargo run $quiet --package subplot --bin sp-docgen -- "$1" --output "$2"
}
# Run unit tests for the Python template.
@@ -80,6 +85,22 @@ then
-exec black --check '{}' +
fi
+(cd subplotlib;
+ $hideok cargo test --lib
+ for md in [!CR]*.md; do
+ $hideok echo "subplotlib/$md ====================================="
+ $hideok mkdir -p tests
+ _codegen "$md" "tests/$(basename "$md" .md).rs" ""
+ # This formatting is fine because we checked --all earlier
+ # so all it'll do is tidy up the test suite
+ cargo fmt
+ docgen "$md" "$(basename "$md" .md).pdf"
+ docgen "$md" "$(basename "$md" .md).html"
+ $hideok cargo test --test "$(basename "$md" .md)"
+ $hideok echo
+ done
+)
+
for md in [!CR]*.md lib/*.md
do
$hideok echo "$md ====================================="