Blame agen5/test/in.test

Packit Service 96b5d3
#! /bin/sh
Packit Service 96b5d3
#  -*- Mode: Shell-script -*-
Packit Service 96b5d3
# ----------------------------------------------------------------------
Packit Service 96b5d3
# in.test --- Verify that the "in?" predicate works
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 out ++][++
Packit Service 96b5d3
Packit Service 96b5d3
(define stack-list (stack "foo.bar"))
Packit Service 96b5d3
(string-append
Packit Service 96b5d3
  (if (in? (get "baz") stack-list) "success" "FAIL")
Packit Service 96b5d3
  "\n"
Packit Service 96b5d3
  (if (in? (get "oops") stack-list) "FAIL" "success")
Packit Service 96b5d3
) ++][++
Packit Service 96b5d3
Packit Service 96b5d3
IF .true ++]
Packit Service 96b5d3
success[++
Packit Service 96b5d3
ELSE     ++]
Packit Service 96b5d3
FAILURE[++
Packit Service 96b5d3
ENDIF    ++]-[++ .true ++][++
Packit Service 96b5d3
Packit Service 96b5d3
IF .false ++]
Packit Service 96b5d3
FAILURE[++
Packit Service 96b5d3
ELSE     ++]
Packit Service 96b5d3
success[++
Packit Service 96b5d3
ENDIF    ++]-[++ .false ++]
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
foo  = { bar = one; };
Packit Service 96b5d3
foo  = { bar = two; };
Packit Service 96b5d3
foo  = { bar = three; };
Packit Service 96b5d3
foo  = { bar = four; };
Packit Service 96b5d3
baz  = three;
Packit Service 96b5d3
oops = oops;
Packit Service 96b5d3
true = true;
Packit Service 96b5d3
false = false;
Packit Service 96b5d3
_EOF_
Packit Service 96b5d3
Packit Service 96b5d3
# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
Packit Service 96b5d3
set -x
Packit Service 96b5d3
echo creating ${testname}.ok
Packit Service 96b5d3
# this is the output we should expect to see
Packit Service 96b5d3
cat > ${testname}.ok <<'_EOF_'
Packit Service 96b5d3
success
Packit Service 96b5d3
success
Packit Service 96b5d3
success-true
Packit Service 96b5d3
success-false
Packit Service 96b5d3
_EOF_
Packit Service 96b5d3
Packit Service 96b5d3
run_ag x ${testname}.def || failure autogen failed
Packit Service 96b5d3
cmp -s ${testname}.ok ${testname}.out || \
Packit Service 96b5d3
  failure "`diff ${testname}.ok ${testname}.test`"
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 in.test