]> diplodocus.org Git - nmh/commitdiff
Here's a better fix for the whatnow tests: set and export
authorDavid Levine <levinedl@acm.org>
Tue, 7 Jan 2014 01:14:20 +0000 (19:14 -0600)
committerDavid Levine <levinedl@acm.org>
Tue, 7 Jan 2014 01:14:20 +0000 (19:14 -0600)
TERM at the beginning of each test so that valgrind can be
supported.

test/whatnow/test-attach-detach
test/whatnow/test-cd
test/whatnow/test-ls

index 9f308aa322aeac809ebde91f3f3e386ca3f1dff0..f7c39e9d6dd40216c994be2655130db88b44973f 100755 (executable)
@@ -17,6 +17,9 @@ fi
 
 setup_test
 
+# Set TERM to get consistent output.
+TERM=dumb; export TERM
+
 cd "$MH_TEST_DIR"
 testname="baz's boz"
 testname_quoted="baz\'s\ boz"
@@ -38,7 +41,7 @@ touch $expected $expectederr $actual $actualerr
 #
 
 set +e
-whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''`
+whatnowtest=`echo cd | whatnow -prompt ''`
 set -e
 
 case ${whatnowtest} in
@@ -63,13 +66,13 @@ esac
 # whatnow's exit status is always 1 so that is not a failure
 set +e
 echo "attach $testname_quoted" | \
-  TERM=dumb whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
-echo "alist" | TERM=dumb whatnow -attach foo -noedit -prompt '' \
-                               2>> $actualerr >> $actual
+  run_prog whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
+echo "alist" | \
+  run_prog whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
 echo "detach $testname_quoted" | \
-  TERM=dumb whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
-echo "alist" | TERM=dumb whatnow -attach foo -noedit -prompt '' \
-                               2>> $actualerr >> $actual
+  run_prog whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
+echo "alist" | \
+  run_prog whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
 set -e
 
 check "$expectederr" "$actualerr"
index 48389cbf02174145c91c797e2dc7b5b83169ba27..8b01ab6c1d3e107e5323832e88481c88e180d170 100755 (executable)
@@ -17,6 +17,9 @@ fi
 
 setup_test
 
+# Set TERM to get consistent output.
+TERM=dumb; export TERM
+
 SPDIR="$MH_TEST_DIR/foo's bar"
 rm -rf "$SPDIR"
 mkdir "$SPDIR"
@@ -32,7 +35,7 @@ actual=$MH_TEST_DIR/$$.actual
 #
 
 set +e
-whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''`
+whatnowtest=`echo cd | whatnow -prompt ''`
 set -e
 
 case ${whatnowtest} in
@@ -58,7 +61,7 @@ EOF
 # ||true to ignore whatnow's exit status
 # watch the quoting -- shell and printf and then the shell run inside whatnow
 printf 'cd %s/foo\\'"'"'s\\ bar\npwd\n' "$MH_TEST_DIR" | \
-  TERM=dumb whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true
+  run_prog whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true
 
 check "$expectederr" "$actualerr"
 check "$expected" "$actual"
index b70f593661a55d76af4b4460654c2d186ee02977..6f2bebca107226194b56ffa9fec50319ff1d564a 100755 (executable)
@@ -17,6 +17,9 @@ fi
 
 setup_test
 
+# Set TERM to get consistent output.
+TERM=dumb; export TERM
+
 SPDIR="$MH_TEST_DIR/foo's bar"
 rm -rf "$SPDIR"
 mkdir "$SPDIR"
@@ -33,7 +36,7 @@ actual=$MH_TEST_DIR/$$.actual
 #
 
 set +e
-whatnowtest=`echo cd | TERM=dumb whatnow -prompt ''`
+whatnowtest=`echo cd | whatnow -prompt ''`
 set -e
 
 case ${whatnowtest} in
@@ -58,7 +61,7 @@ cat > $expectederr <<EOF
 EOF
 
 # NB use of sort as the order of output of ls is not guaranteed
-echo 'ls' | TERM=dumb whatnow -noedit -prompt '' 2> "$actualerr" | \
+echo 'ls' | run_prog whatnow -noedit -prompt '' 2> "$actualerr" | \
        sort > "$actual"
 
 check "$expectederr" "$actualerr" 'keep first'
@@ -68,7 +71,7 @@ check "$expected" "$actual" 'keep first'
 # /bin/sh sets SHELL, which bash does.
 unset SHELL
 
-echo 'ls' | TERM=dumb whatnow -noedit -prompt '' 2> "$actualerr" | \
+echo 'ls' | run_prog whatnow -noedit -prompt '' 2> "$actualerr" | \
        sort > "$actual"
 
 check "$expectederr" "$actualerr"