automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] {testsuite-work} self tests: check that `$me' can be overridden


From: Stefano Lattarini
Subject: [PATCH] {testsuite-work} self tests: check that `$me' can be overridden
Date: Sun, 5 Jun 2011 21:33:20 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

I will push in 48 hours if there's no review by then.

Regards,
  Stefano
From b896ed66cb809000e57dfb7ba4913e56a510851e Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Sun, 5 Jun 2011 20:58:21 +0200
Subject: [PATCH] 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.
---
 ChangeLog                |    8 ++++++++
 tests/self-check-me.test |   15 ++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d8f4b8..bfec5b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-06-05  Stefano Lattarini  <address@hidden>
+
+       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  <address@hidden>
 
        self tests: fix another spurious failure
diff --git a/tests/self-check-me.test b/tests/self-check-me.test
index 8fd2bc0..e8b1361 100755
--- a/tests/self-check-me.test
+++ b/tests/self-check-me.test
@@ -15,7 +15,8 @@
 # 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
 
@@ -29,4 +30,16 @@ $SHELL -c '. ./defs && echo me=$me' 012.test | grep 
'^me=012$'
 $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
+
 :
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]