feat: test each example using a separate file

This commit is contained in:
Leonardo de Moura 2020-11-19 13:51:52 -08:00
parent 72a6ce498a
commit e29cc367f3

View file

@ -1,2 +1,11 @@
#!/usr/bin/env bash
awk 'BEGIN { lean = 0 } /```/ { if (lean == 1) lean = 0; } { if (lean == 1) { sub(/# /, ""); print $0 } } /```lean/ && !/```lean,ignore/ { lean = 1 }' $1 | lean --stdin
awk 'BEGIN { lean = 0; idx = 0 } /```/ { if (lean == 1) lean = 0; } { if (lean == 1) { sub(/# /, ""); print $0 > out } } /```lean/ && !/```lean,ignore/ { lean = 1; idx = idx + 1; out = FILENAME "." idx ".lean" }' $1
for f in `ls $1.*.lean`; do
echo "testing $f"
if ! lean $f; then
echo "FAILED"
rm -f $1.*.lean
exit 1
fi
rm $f
done