2013-11-18 23:02:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Test is all examples in the .md files are working
|
|
|
|
if [ $# -ne 2 ]; then
|
2013-11-20 00:47:47 +00:00
|
|
|
echo "Usage: test.sh [lean-executable-path] [file]"
|
2013-11-18 23:02:12 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
ulimit -s unlimited
|
2013-11-20 00:47:47 +00:00
|
|
|
LEAN=$1
|
2013-11-18 23:02:12 +00:00
|
|
|
f=$2
|
|
|
|
echo "-- testing $f"
|
2015-03-29 03:29:52 +00:00
|
|
|
awk 'BEGIN{ in_block = 0 } !/```/{ if (in_block == 1) print $0; else print "" } /```/ && !/```lua/{ in_block = 0; print "" } /```lua/{ in_block = 1; print "" }' "$f" > "$f.lua"
|
|
|
|
if "$LEAN" "$f.lua" > "$f.produced.out"; then
|
2013-11-18 23:02:12 +00:00
|
|
|
echo "-- worked"
|
|
|
|
exit 0
|
|
|
|
else
|
2013-11-18 23:39:55 +00:00
|
|
|
echo "ERROR executing $f.lua, produced output:"
|
2015-03-29 03:29:52 +00:00
|
|
|
cat "$f.produced.out"
|
2013-11-18 23:02:12 +00:00
|
|
|
exit 1
|
|
|
|
fi
|