lean2/doc/lean/test_single.sh
Leonardo de Moura 3874e23a76 doc(doc/lean): expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 21:29:54 -08:00

19 lines
554 B
Bash
Executable file

#!/bin/sh
# Test is all examples in the .md files are working
if [ $# -ne 2 ]; then
echo "Usage: test.sh [lean-executable-path] [file]"
exit 1
fi
ulimit -s unlimited
LEAN=$1
f=$2
echo "-- testing $f"
awk 'BEGIN{ in_block = 0 } !/```/{ if (in_block == 1) print $0; else print "" } /```/ && !/```lean/{ in_block = 0; print "" } /```lean/{ in_block = 1; print "" }' $f > $f.lean
if $LEAN $f.lean > $f.produced.out; then
echo "-- worked"
exit 0
else
echo "ERROR executing $f.lean, produced output:"
cat $f.produced.out
exit 1
fi