#! /bin/sh # -*- Mode: Shell-script -*- # ---------------------------------------------------------------------- # html.test --- test html generation # # Time-stamp: "2007-07-04 11:30:14 bkorb" # Author: Bruce Korb ## ## This file is part of AutoGen. ## AutoGen copyright (c) 1992-2007 by Bruce Korb - all rights reserved ## ## AutoGen is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## AutoGen is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ## See the GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License along ## with this program. If not, see . ## # # $Id: html.test,v 4.7 2007/07/04 20:51:13 bkorb Exp $ # ---------------------------------------------------------------------- . ./defs # # # # # # # # # # TEMPLATE FILES # # # # # # # # # echo creating cgi.tpl cat > cgi.tpl <<'_EOF_' HTTP/1.0 500 AutoGen Forms Error Content-Type: text/plain The submitted form does not contain a valid template () . _EOF_ echo creating ${testname}.tpl cat > ${testname}.tpl <<'_EOF_' Mumble: Foolish: _EOF_ # # # # # # # SAMPLE OUTPUT FILE # # # # # # echo creating ${testname}.out in `pwd` # this is the output we should expect to see cat > ${testname}.samp <<'_EOF_' Content-Type: text/html Mumble: fumble bumble Foolish: bar _EOF_ # # # # # # # RUN AUTOGEN # # # # # # REQUEST_METHOD=GET QUERY_STRING="mumble=fumble+bumble&foo=bar&template=${testname}" CONTENT_LENGTH=`expr "${QUERY_STRING}" : ".*"` export CONTENT_LENGTH REQUEST_METHOD QUERY_STRING ${AGexe} | ${EGREP} -v '^in state' > ${testname}.test || \ failure autogen failed # # # # # # # TEST RESULTS # # # # # # cmp -s ${testname}.samp ${testname}.test || \ failure "`diff ${testname}.samp ${testname}.test`" QUERY_STRING="${QUERY_STRING}&break=true" CONTENT_LENGTH=`expr "${QUERY_STRING}" : ".*"` ${AGexe} > ${testname}-2.test && \ failure autogen unexpectedly succeeded cat > ${testname}-2.samp <<'_EOF_' Content-type: text/plain AutoGen form processing error: cgi.tpl:9:22: In expression (define foo bogus): cgi.tpl:9:22: Unbound variable: bogus Scheme evaluation error. AutoGen ABEND-ing in template cgi.tpl on line 9 Failing Guile command: = = = = = (if (exist? "break") (define foo bogus)) ================================= _EOF_ ${EGREP} -v '^in state' ${testname}-2.test > ${testname}-2.res cmp -s ${testname}-2.samp ${testname}-2.res || { exec >&2 echo Your Guile library does not handle error traps correctly and causes echo garbage to be emitted instead. Do not use this autogen as a CGI service. } cleanup ## Local Variables: ## Mode: shell-script ## indent-tabs-mode: nil ## sh-indentation: 2 ## End: # end of html.test