]> rtime.felk.cvut.cz Git - wvtest.git/commitdiff
sh: add new WVPASSRC and WVFAILRC commands.
authorAvery Pennarun <apenwarr@gmail.com>
Tue, 16 Feb 2010 22:01:38 +0000 (17:01 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Tue, 16 Feb 2010 22:05:56 +0000 (17:05 -0500)
For testing the value of $?.

sh/t/twvtest.sh
sh/wvtest.sh

index fbc709fe99bf4f0f88bcc299d8c9a903aa521b5b..875dd5373ce621f45e85d96db2153c657e6ab0be 100755 (executable)
@@ -9,6 +9,8 @@ WVFAIL false
 WVPASSEQ "$(ls | sort)" "$(ls)"
 WVPASSNE "5" "5 "
 WVPASSEQ "" ""
+(echo nested test; true); WVPASSRC $?
+(echo nested fail; false); WVFAILRC $?
 
 WVSTART another test
 WVPASS true
index 36a1862d21e0e7c03f13d5af0189a50b74882bbf..44f7d9e2d021e446665d0394d227bfd8d4d1a79a 100644 (file)
@@ -99,6 +99,22 @@ WVPASSNE()
 }
 
 
+WVPASSRC()
+{
+       RC=$?
+       _wvfind_caller
+       _wvcheck $(_wvgetrv [ $RC -eq 0 ]) "return code($RC) == 0"
+}
+
+
+WVFAILRC()
+{
+       RC=$?
+       _wvfind_caller
+       _wvcheck $(_wvgetrv [ $RC -ne 0 ]) "return code($RC) != 0"
+}
+
+
 WVSTART()
 {
        echo >&2