diff options
author | fuzzyray <fuzzyray@gentoo.org> | 2009-04-30 21:52:45 +0000 |
---|---|---|
committer | fuzzyray <fuzzyray@gentoo.org> | 2009-04-30 21:52:45 +0000 |
commit | 86eaf5e03289e45a95514b4f6011157972016e9d (patch) | |
tree | c16903693f2030c7b01b346b29b265dc1a473888 /src/equery/tests/common-functions.sh | |
parent | Fix has_key() deprecation message. (Bug #232797) (diff) | |
download | gentoolkit-0.2.4.tar.gz gentoolkit-0.2.4.tar.bz2 gentoolkit-0.2.4.zip |
Tagging the gentoolkit-0.2.4 releasegentoolkit-0.2.4
svn path=/tags/gentoolkit-0.2.4/; revision=564
Diffstat (limited to 'src/equery/tests/common-functions.sh')
-rw-r--r-- | src/equery/tests/common-functions.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/equery/tests/common-functions.sh b/src/equery/tests/common-functions.sh new file mode 100644 index 0000000..f065a0a --- /dev/null +++ b/src/equery/tests/common-functions.sh @@ -0,0 +1,52 @@ +#! /bin/bash +# +# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org> +# Copyright (c) 2004, Gentoo Foundation +# +# Licensed under the GNU General Public License, v2 + +function tempfilename() { + fn=$(date "+%s") + if [ ! -f ${fn}.tmp ] ; then + echo ${fn}.tmp + fi +} + +function report_pass() { + printf "%-40s - passed\n" ${1} +} + +function report_failure() { + printf "%-40s - FAILED!\n" ${1} +} + +function assert_samefile() { + diff $2 $3 && report_pass $1 || report_failure $1 +} + +function assert_eq() { + if [ $2 -eq $3 ] ; then + report_pass $1 + else + printf "FAIL: $2 ! -eq $3\n" + report_failure $1 + fi +} + +function assert_ge() { + if [ $2 -ge $3 ] ; then + report_pass $1 + else + printf "FAIL: $2 ! -ge $3\n" + report_failure $1 + fi +} + +function assert_exists() { + if [ -f $2 ] ; then + report_pass $1 + else + printf "FAIL: $2 does not exist\n" + report_failure $1 + fi +}
\ No newline at end of file |