Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Fix #91: add bikeshed doc #95

Merged
merged 7 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

usage () {
echo "compile.sh [-Kh?]"
echo " -K Keep the actual-errs.txt. Useful for updating"
echo " expected-errs.txt. (Otherwise removed when done.)"
echo " -h This help"
echo " -? This help"
exit 0
}

KEEP=no
while getopts "Kh?" arg
do
case $arg in
K) KEEP=yes ;;
h) usage ;;
\?) usage ;;
esac
done

# So we can see what we're doing
set -x

# Output from bikeshed is logged here, along with a version with line
# numbers stripped out.
BSLOG="bs.log"
ERRLOG="actual-errs.txt"

# Remove ERRLOG when we're done with this script, but keep BSLOG so we
# can update the expected errors.
if [ "$KEEP" = "no" ]; then
trap "rm $ERRLOG" 0
fi

# Run bikeshed and save the output. You can use this output as is
# to update expected-errs.txt.
bikeshed --print=plain -f spec 2>&1 | tee $BSLOG
# Remove the line numbers from the log, and make sure it ends with a
# newline.
sed 's;^LINE [0-9]*:;LINE:;' $BSLOG | sed -e '$a\' > $ERRLOG
# Do the same for the expected errors and compare the two. Any
# differences need to be fixed. Exit with a non-zero exit code if
# there are any differences.
(sed 's;^LINE [0-9]*:;LINE:;' expected-errs.txt | sed -e '$a\' | diff -u - $ERRLOG) || exit 1

Loading