1#! /bin/sh
2#  -*- Mode: Shell-script -*-
3# dynref.test --- test dynamic scoping of definition values
4#
5# Author:            Bruce Korb <bkorb@gnu.org>
6##
7## This file is part of AutoGen.
8## AutoGen Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
9##
10## AutoGen is free software: you can redistribute it and/or modify it
11## under the terms of the GNU General Public License as published by the
12## Free Software Foundation, either version 3 of the License, or
13## (at your option) any later version.
14##
15## AutoGen is distributed in the hope that it will be useful, but
16## WITHOUT ANY WARRANTY; without even the implied warranty of
17## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18## See the GNU General Public License for more details.
19##
20## You should have received a copy of the GNU General Public License along
21## with this program.  If not, see <http://www.gnu.org/licenses/>.
22##
23#
24# ----------------------------------------------------------------------
25
26. ./defs
27
28# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
29
30echo creating $testname.tpl
31cat > $testname.tpl <<'_EOF_'
32[= AutoGen5 Template test =]
33[=
34
35DEFINE nest         =][=
36
37  FOR nesting        =][=
38    IF (first-for?)
39=]The un-nested value is:  [=val_u=].[=
40    ENDIF           =][=
41  ENDFOR            =][=
42
43ENDDEF              =][=
44
45nest Val-u = "hidden value"
46
47=]
48_EOF_
49
50
51# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
52
53echo creating $testname.def
54cat > $testname.def <<_EOF_
55autogen definitions $testname;
56
57nesting = { name = one;   };
58nesting = { name = two;   };
59nesting = { name = three; };
60nesting = { name = four;  };
61_EOF_
62
63# this is the output we should expect to see
64cat > $testname.out <<_EOF_
65The un-nested value is:  hidden value.
66_EOF_
67
68run_ag x $testname.def || failure autogen failed
69cmp -s $testname.test $testname.out || \
70  failure "`diff $testname.test $testname.out`"
71
72cleanup
73
74## Local Variables:
75## mode: shell-script
76## indent-tabs-mode: nil
77## sh-indentation: 2
78## sh-basic-offset: 2
79## End:
80
81# end of dynref.test
82