aboutsummaryrefslogtreecommitdiff
path: root/test/utils.bash
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-04-20 21:26:52 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2013-04-20 21:26:52 +0200
commit875716dc48cd5c485d2342c9e5bb1d461bc64b6d (patch)
treee8429406bfb43f593008375b673c6669c72f32f2 /test/utils.bash
parent32826f3c989e63f53510a9bdccd1855a9ae00636 (diff)
downloadapp.sh-875716dc48cd5c485d2342c9e5bb1d461bc64b6d.tar.gz
app.sh-875716dc48cd5c485d2342c9e5bb1d461bc64b6d.tar.bz2
app.sh-875716dc48cd5c485d2342c9e5bb1d461bc64b6d.tar.xz
app.sh-875716dc48cd5c485d2342c9e5bb1d461bc64b6d.zip
o Making the resolvers use app.resolved_version instead of app.version.
o Making set-version update app.version.
Diffstat (limited to 'test/utils.bash')
-rw-r--r--test/utils.bash36
1 files changed, 26 insertions, 10 deletions
diff --git a/test/utils.bash b/test/utils.bash
index cb2337b..ad80629 100644
--- a/test/utils.bash
+++ b/test/utils.bash
@@ -61,16 +61,16 @@ app_libexec() {
run "$x" $@
}
-fix_path=`uname -s`
+fix_path_uname=`uname -s`
fix_path() {
- local path=$1
-
- case $fix_path in
+ case $fix_path_uname in
CYGWIN_NT*)
- x=$(cygpath -wa $1)
+ cygpath -wa $1
+ ;;
+ *)
+ echo $1
;;
esac
- echo $x
}
describe() {
@@ -100,8 +100,8 @@ can_not_read() {
is_directory() {
if [ ! -d "$1" ]
then
- echo "Not a directory: $1" 2>&1
- return 1
+ echo "Not a directory: $1" 2>&1
+ return 1
fi
}
@@ -112,7 +112,7 @@ eq() {
if [[ $e == $a ]]
then
- return 0
+ return 0
fi
echo "Assertion failed: $ex"
@@ -121,6 +121,22 @@ eq() {
exit 1
}
+neq() {
+ local ex="$1"
+ local e="$2"
+ local a="`eval echo $ex`"
+
+ if [[ $e != $a ]]
+ then
+ return 0
+ fi
+
+ echo "Not-equal assertion failed: $ex"
+ echo "Expected: $e"
+ echo "Actual: $a"
+ exit 1
+}
+
match() {
local ex="$1"
local regex="$2"
@@ -128,7 +144,7 @@ match() {
if [[ $a =~ $regex ]]
then
- return 0
+ return 0
fi
echo "Assertion failed: $ex =~ $a"