Blame agen5/test/get.test

Packit Service 96b5d3
#! /bin/sh
Packit Service 96b5d3
#  -*- Mode: Shell-script -*-
Packit Service 96b5d3
# get.test --- test get functionality
Packit Service 96b5d3
#
Packit Service 96b5d3
# Author:            Bruce Korb <bkorb@gnu.org>
Packit Service 96b5d3
##
Packit Service 96b5d3
## This file is part of AutoGen.
Packit Service 96b5d3
## AutoGen Copyright (C) 1992-2016 by Bruce Korb - all rights reserved
Packit Service 96b5d3
##
Packit Service 96b5d3
## AutoGen is free software: you can redistribute it and/or modify it
Packit Service 96b5d3
## under the terms of the GNU General Public License as published by the
Packit Service 96b5d3
## Free Software Foundation, either version 3 of the License, or
Packit Service 96b5d3
## (at your option) any later version.
Packit Service 96b5d3
##
Packit Service 96b5d3
## AutoGen is distributed in the hope that it will be useful, but
Packit Service 96b5d3
## WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 96b5d3
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit Service 96b5d3
## See the GNU General Public License for more details.
Packit Service 96b5d3
##
Packit Service 96b5d3
## You should have received a copy of the GNU General Public License along
Packit Service 96b5d3
## with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit Service 96b5d3
##
Packit Service 96b5d3
#
Packit Service 96b5d3
# ----------------------------------------------------------------------
Packit Service 96b5d3
Packit Service 96b5d3
. ./defs
Packit Service 96b5d3
Packit Service 96b5d3
# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
Packit Service 96b5d3
Packit Service 96b5d3
echo creating $testname.tpl
Packit Service 96b5d3
cat > $testname.tpl <<_EOF_
Packit Service 96b5d3
[= AutoGen5 template test =]
Packit Service 96b5d3
[=
Packit Service 96b5d3
Packit Service 96b5d3
IF (not (exist? "foo.bar.baz"))  =][=
Packit Service 96b5d3
  (error "foo.bar.baz does, too, exist!")   =][=
Packit Service 96b5d3
Packit Service 96b5d3
ELIF (not (= "mumble" (get "foo.bar.baz"))) =][=
Packit Service 96b5d3
  (error (sprintf "We got the wrong baz.  We got:  %s"
Packit Service 96b5d3
         (get "foo.bar.baz")))   =][=
Packit Service 96b5d3
ELSE
Packit Service 96b5d3
      =]A OK[=
Packit Service 96b5d3
ENDIF =][=
Packit Service 96b5d3
Packit Service 96b5d3
- bogus "\nA OK2" =][=
Packit Service 96b5d3
- foo   "\nBOGUS" =]
Packit Service 96b5d3
[= (get "fuz-zy") =]
Packit Service 96b5d3
[= (get "fuz_zy") =]
Packit Service 96b5d3
[= (get "fuz^zy") =]
Packit Service 96b5d3
[= (get-c-name    "fuz-zy") =]
Packit Service 96b5d3
[= (get-up-name   "fuz-zy") =]
Packit Service 96b5d3
[= (get-down-name "fuz-zy") =]
Packit Service 96b5d3
_EOF_
Packit Service 96b5d3
Packit Service 96b5d3
# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
Packit Service 96b5d3
Packit Service 96b5d3
echo creating $testname.def
Packit Service 96b5d3
cat > $testname.def <<_EOF_
Packit Service 96b5d3
AutoGen definitions $testname;
Packit Service 96b5d3
Packit Service 96b5d3
foo = { bar = { nada = nothing; }; };
Packit Service 96b5d3
foo = { bar = { baz  = mumble;  }; };  /* this is the one */
Packit Service 96b5d3
foo = { bar = { baz  = grumble; }; };
Packit Service 96b5d3
fuz-zy = Mum-Ble;
Packit Service 96b5d3
_EOF_
Packit Service 96b5d3
Packit Service 96b5d3
# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
Packit Service 96b5d3
set -x
Packit Service 96b5d3
echo creating $testname.out
Packit Service 96b5d3
# this is the output we should expect to see
Packit Service 96b5d3
cat > $testname.out <<'_EOF_'
Packit Service 96b5d3
A OK
Packit Service 96b5d3
A OK2
Packit Service 96b5d3
Mum-Ble
Packit Service 96b5d3
Mum-Ble
Packit Service 96b5d3
Mum-Ble
Packit Service 96b5d3
Mum_Ble
Packit Service 96b5d3
MUM_BLE
Packit Service 96b5d3
mum_ble
Packit Service 96b5d3
_EOF_
Packit Service 96b5d3
Packit Service 96b5d3
run_ag x $testname.def || failure autogen failed
Packit Service 96b5d3
cmp -s $testname.test $testname.out || failure unexpected output
Packit Service 96b5d3
Packit Service 96b5d3
cleanup
Packit Service 96b5d3
Packit Service 96b5d3
## Local Variables:
Packit Service 96b5d3
## mode: shell-script
Packit Service 96b5d3
## indent-tabs-mode: nil
Packit Service 96b5d3
## sh-indentation: 2
Packit Service 96b5d3
## sh-basic-offset: 2
Packit Service 96b5d3
## End:
Packit Service 96b5d3
Packit Service 96b5d3
# end of get.test