changeset 2843:0b9ac7dfcf56

Fix some tests for portability.
author Danek Duvall <danek.duvall@sun.com>
date Wed, 09 Aug 2006 12:05:40 -0700
parents 49988d9f0758
children 582cbc4392cb
files tests/test-abort-checkin tests/test-globalopts tests/test-import tests/test-mq tests/test-mq-qrefresh-replace-log-message
diffstat 5 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-abort-checkin	Wed Aug 09 13:55:18 2006 -0500
+++ b/tests/test-abort-checkin	Wed Aug 09 12:05:40 2006 -0700
@@ -3,6 +3,11 @@
 HGRCPATH=$HGTMP/.hgrc; export HGRCPATH
 echo "[extensions]" >> $HGTMP/.hgrc
 echo "mq=" >> $HGTMP/.hgrc
+cat > $HGTMP/false <<EOF
+#!/bin/sh
+exit 1
+EOF
+chmod +x $HGTMP/false
 
 hg init foo
 cd foo
@@ -11,7 +16,7 @@
 
 # mq may keep a reference to the repository so __del__ will not be called
 # and .hg/journal.dirstate will not be deleted:
-HGEDITOR=false hg ci
-HGEDITOR=false hg ci
+HGEDITOR=$HGTMP/false hg ci
+HGEDITOR=$HGTMP/false hg ci
 
 exit 0
--- a/tests/test-globalopts	Wed Aug 09 13:55:18 2006 -0500
+++ b/tests/test-globalopts	Wed Aug 09 12:05:40 2006 -0700
@@ -45,7 +45,7 @@
 hg --cwd b tip --verbose
 
 echo %% --config
-hg --cwd c --config paths.quuxfoo=bar paths | grep -q quuxfoo && echo quuxfoo
+hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
 hg --cwd c --config '' tip -q
 hg --cwd c --config a.b tip -q
 hg --cwd c --config a tip -q
--- a/tests/test-import	Wed Aug 09 13:55:18 2006 -0500
+++ b/tests/test-import	Wed Aug 09 12:05:40 2006 -0700
@@ -72,7 +72,7 @@
 
 echo % plain diff in email, no subject, no message body, should fail
 hg clone -r0 a b
-grep -v '^\(Subject\|email\)' msg.patch | hg --cwd b import -
+egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
 rm -rf b
 
 echo % hg export in email, should use patch header
@@ -89,9 +89,10 @@
 echo % hg import in a subdirectory
 hg clone -r0 a b
 hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch
-pushd b/d1/d2 2>&1 > /dev/null
+dir=`pwd`
+cd b/d1/d2 2>&1 > /dev/null
 hg import  ../../../tip.patch
-popd  2>&1 > /dev/null
+cd $dir
 echo "% message should be 'subdir change'"
 hg --cwd b tip | grep 'subdir change'
 echo "% committer should be 'someoneelse'"
--- a/tests/test-mq	Wed Aug 09 13:55:18 2006 -0500
+++ b/tests/test-mq	Wed Aug 09 12:05:40 2006 -0700
@@ -48,7 +48,7 @@
 
 echo a >> a
 hg qrefresh
-sed -e "s/\(^diff -r \)\([a-f0-9]* \)/\1 x/" \
+sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
     -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
     -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
 
--- a/tests/test-mq-qrefresh-replace-log-message	Wed Aug 09 13:55:18 2006 -0500
+++ b/tests/test-mq-qrefresh-replace-log-message	Wed Aug 09 12:05:40 2006 -0700
@@ -33,7 +33,7 @@
 echo bbbb > file
 hg qrefresh -l logfile
 echo =======================
-echo "Should display 'Third commit message\n This is the 3rd log message'"
+printf "Should display 'Third commit message\\\n This is the 3rd log message'\n"
 hg log -l1 -v | sed -n '/description/,$p'
 echo
 
@@ -46,6 +46,6 @@
 echo " This is the 5th log message" >> logfile) |\
 hg qrefresh -l-
 echo =======================
-echo "Should display 'Fifth commit message\n This is the 5th log message'"
+printf "Should display 'Fifth commit message\\\n This is the 5th log message'\n"
 hg log -l1 -v | sed -n '/description/,$p'
 echo