2 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Sanity check for the automake testsuite.
18 # Make sure that $me gets automatically defined by 'test-init.sh'.
25 # This test becomes cumbersome if we keep the 'errexit' shell flag set.
26 # And removing it is no big deal, as this test is a TAP-based one, so
27 # that false positives remain very unlikely.
32 $AM_TEST_RUNNER_SHELL -c '
33 am_create_testdir=no # Do not pollute the top-level directory.
36 ' "$1" | grep "^me=$2$"
37 command_ok_ "me=$1" test $? -eq 0
41 do_check foo-bar-.$e 'foo-bar-'
42 do_check _foo__bar.$e '_foo__bar'
44 do_check a.b.c.$e 'a\.b\.c'
47 do_check foo.bar 'foo\.bar'
50 # A definition of $me in the environment should be ignored.
52 s=$(me=bad $AM_TEST_RUNNER_SHELL -c '
53 # Do not pollute the top-level directory.
58 command_ok_ "override of \$me before test-init.sh causes no error" \
62 printf '%s\n' "$s" | grep '^me=foo$' || r='not ok'
63 printf '%s\n' "$s" | grep 'me=bad' && r='not ok'
64 result_ "$r" "\$me from the environment is ignored"