#! /bin/sh # -*- Mode: Shell-script -*- # defref.test --- definition reference testing # # Time-stamp: "2007-07-04 11:29:24 bkorb" # Author: Bruce Korb # Last Modified: $Date: 2007/07/04 20:51:13 $ # by: bkorb ## ## 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: defref.test,v 4.7 2007/07/04 20:51:13 bkorb Exp $ # ---------------------------------------------------------------------- . ./defs # # # # # # # # # # TEMPLATE FILE # # # # # # # # # sed 's/^ *[0-9]*: //' > ${testname}.tpl <<_EOF_ 1: <= AutoGen5 template test => 2: The last of each list:<= 3: FOR list => 4: list[<= (for-index) =>] -> <= val[$] =><= 5: ENDFOR => 6: 7: The first of each list:<= 8: FOR list => 9: list[<=(for-index)=>] -> <=val[]=><= 10: ENDFOR => 11: 12: The full list:<= 13: FOR list => 14: list[<=(for-index)=>] -> <= 15: FOR val ", " => val[<=(for-index)=>]=<=val=><= 16: ENDFOR =><= 17: ENDFOR => 18: 19: The first value is: <= ?% list[].val[] "val = %s (first)" "Undefined??"=> 20: The last value is: <= ?% list[$].val[$] "val = %s (last)" "Undefined??"=> _EOF_ # # # # # # # # # # DEFINITIONS FILE # # # # # # # # # # Create the files we need in the test environment cat > ${testname}.def <<_EOF_ AutoGen definitions "${testname}." "tpl"; list = { val = L0.first, L0.second, L0.last; }, { val[2] = L1.second-and-last; Val[0] = L1.first; }; List[3] = { val = L3.third.all; }, { val[3] = L4.last; VAL[2] = L4.middle; VAL[1] = L4.first; }; _EOF_ # # # # # # # # # # ANTICIPATED RESULT # # # # # # # # # cat > ${testname}.out <<_EOF_ The last of each list: list[0] -> L0.last list[1] -> L1.second-and-last list[3] -> L3.third.all list[4] -> L4.last The first of each list: list[0] -> L0.first list[1] -> L1.first list[3] -> L3.third.all list[4] -> L4.first The full list: list[0] -> val[0]=L0.first, val[1]=L0.second, val[2]=L0.last list[1] -> val[0]=L1.first, val[2]=L1.second-and-last list[3] -> val[0]=L3.third.all list[4] -> val[1]=L4.first, val[2]=L4.middle, val[3]=L4.last The first value is: val = L0.first (first) The last value is: val = L4.last (last) _EOF_ ${AGexe} ${testname}.def || failure AutoGen failed cmp -s ${testname}.test ${testname}.out || \ failure "`diff ${testname}.test ${testname}.out`" cleanup ## Local Variables: ## Mode: shell-script ## indent-tabs-mode: nil ## sh-indentation: 2 ## End: # end of defref.test