]> arthur.barton.de Git - bup.git/blobdiff - wvtest.sh
A bunch of wvtests for the 'bup index' command.
[bup.git] / wvtest.sh
index 0ed5fb0cdadb541ffc2e6a0847429c86907a4da0..90bdc909b5e34a625ad2d3729b7277a5d38da67f 100644 (file)
--- a/wvtest.sh
+++ b/wvtest.sh
@@ -1,6 +1,3 @@
-WVIFS=" 
-"
-
 # we don't quote $TEXT in case it contains newlines; newlines
 # aren't allowed in test output.  However, we set -f so that
 # at least shell glob characters aren't processed.
@@ -28,10 +25,7 @@ _wvcheck()
 
 WVPASS()
 {
-       #xIFS="$IFS"
-       #IFS="$WVIFS"
        TEXT="$*"
-       #IFS="$xIFS"
        
        if "$@"; then
                _wvcheck 0 "$TEXT"
@@ -46,10 +40,7 @@ WVPASS()
 
 WVFAIL()
 {
-       #xIFS="$IFS"
-       #IFS="$WVIFS"
        TEXT="$*"
-       #IFS="$xIFS"
        
        if "$@"; then
                _wvcheck 1 "NOT($TEXT)"
@@ -62,6 +53,35 @@ WVFAIL()
 }
 
 
+_wvgetrv()
+{
+       ( "$@" >&2 )
+       echo -n $?
+}
+
+
+WVPASSEQ()
+{
+       WVPASS [ "$#" -eq 2 ]
+       echo "Comparing:" >&2
+       echo "$1" >&2
+       echo "--" >&2
+       echo "$2" >&2
+       _wvcheck $(_wvgetrv [ "$1" = "$2" ]) "'$1' = '$2'"
+}
+
+
+WVPASSNE()
+{
+       WVPASS [ "$#" -eq 2 ]
+       echo "Comparing:" >&2
+       echo "$1" >&2
+       echo "--" >&2
+       echo "$2" >&2
+       _wvcheck $(_wvgetrv [ "$1" != "$2" ]) "'$1' != '$2'"
+}
+
+
 WVSTART()
 {
        echo >&2