#! /bin/bash
# $Id$
set -o errexit

# kludge: break up the output into lines
S1='s/\$\[/\
\$\[/g'
S2='s/,\] $/,\
\] /g'

for CASE in test-mailtable-*.in; do
    CASE=${CASE%.in}
    echo $CASE
    AGPROG='`Mailtable ($["filename": "'$CASE.in'", "continue_escaped_newline": true, "continue_leading_blanks": true, "colon": true,])
`Read (.leading_comment)
`Read (.table)
`Read (.trailing_comment)'
    echo "$AGPROG" \
	| ./ag_mailtable -l - "$@" \
	| ycpc -l - -E - \
	| sed -e "$S1" -e "$S2" > $CASE.out.tmp
    diff -u $CASE.out $CASE.out.tmp
done
