Skip to content
Browse files

improved some, added some test for funcs

  • Loading branch information...
1 parent ebf29cc commit 4d0aafe80a393d7ba1e9db9590d1cb9971ea9364 @jankom jankom committed Jan 28, 2012
Showing with 27 additions and 8 deletions.
  1. +0 −8 mtl-funcs
  2. +27 −0 test/funcs
View
8 mtl-funcs
@@ -41,11 +41,3 @@ getblob(){
echo "../${DOC}"
fi
}
-
-#echo $(getblob 2012-01-25~1 1)
-#echo $(getdocname 2012-01-25~1)
-#echo $(resolvedoc :today)
-#echo $(resolvedoc :today~1~2)
-#echo $(resolvedoc :today~w)
-#echo $(getdoc :today~1~1)
-#echo $(getdocname 2012-01-25~1)
View
27 test/funcs
@@ -0,0 +1,27 @@
+#!/bin/bash
+. ../mtl-funcs
+
+#todo make some simple testing function
+
+testit() {
+ if [[ $(eval $2) == $3 ]]; then
+ echo "+++ $1 passed"
+ echo ""
+ else
+ echo "!!! $1 failed"
+ echo " expected:"
+ echo "$3"
+ echo " got:"
+ echo $(eval $2)
+ echo ""
+ fi
+}
+
+
+testit "1" "getblob 2012-01-25~1 1" ""
+testit "2" "getdocname 2012-01-25~1" "2012-01-25"
+testit "3" "resolvedoc :today" "2012-01-28~~"
+testit "4" "resolvedoc :today~1~2" "2012-01-28~1~2"
+testit "5" "resolvedoc :today~w" "2012-01-28~w~"
+testit "6" "getdoc :today~1~1" "2012-01-28"
+testit "7" "getdocname 2012-01-25~1" "2012-01-25"

0 comments on commit 4d0aafe

Please sign in to comment.
Something went wrong with that request. Please try again.