+2011-06-05 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ self tests: check that `$me' can be overridden
+ * tests/self-check-me.test: Check that `$me' can be overridden
+ before sourcing ./defs, with or without sourcing ./defs-static
+ beforehand, and that this override is honored. Update heading
+ comments.
+
2011-06-02 Stefano Lattarini <stefano.lattarini@gmail.com>
self tests: fix another spurious failure
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Sanity check for the automake testsuite.
-# Make sure that $me gets automatically defined by `./defs'.
+# Make sure that $me gets automatically defined by `./defs', and that it
+# can be overridden by the test script.
. ./defs-static || exit 1
$SHELL -c '. ./defs && echo me=$me' foo.bar | grep '^me=foo\.bar$'
$SHELL -c '. ./defs && echo me=$me' a.b.c.test | grep '^me=a\.b\.c$'
+# Overriding $me after sourcing ./defs-static should work.
+s=`$SHELL -c '. ./defs-static && me=zardoz && . ./defs && echo me=$me' \
+ bad.test` || exit 1
+printf '%s\n' "$s" | grep '^me=zardoz$'
+printf '%s\n' "$s" | grep 'me=bad' && exit 1
+
+# If we override $me, ./defs should not modify it.
+s=`$SHELL -c 'me=foo.test && . ./defs && echo me=$me' \
+ bad.test` || exit 1
+printf '%s\n' "$s" | grep '^me=foo\.test$'
+printf '%s\n' "$s" | grep 'me=bad' && exit 1
+
: