Add Bash libs tmpdir and log_warn_die. Docu parse_options. Don't use TMPDIR in test-bash-functions; add ok() to test-bash-functions.

This commit is contained in:
Daniel Nichter
2011-10-27 11:56:58 -06:00
parent 1ae8661271
commit 1ec666de0e
5 changed files with 215 additions and 13 deletions

44
t/lib/bash/tmpdir.sh Normal file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bash
TESTS=9
source "$LIB_DIR/log_warn_die.sh"
source "$LIB_DIR/tmpdir.sh"
TEST_NAME="TMPDIR not defined"
is "$TMPDIR" ""
TEST_NAME="set_TMPDIR makes secure tmpdir"
set_TMPDIR
ok "test -d $TMPDIR"
tmpdir=$TMPDIR;
TEST_NAME="rm_TMPDIR"
rm_TMPDIR
ok "test ! -d $tmpdir"
TEST_NAME="rm_TMPDIR resets TMPDIR"
is "$TMPDIR" ""
# --tmpdir
OPT_TMPDIR="/tmp/use--tmpdir"
TEST_NAME="TMPDIR not defined"
is "$TMPDIR" ""
TEST_NAME="--tmpdir does not exist yet"
ok "test ! -d $OPT_TMPDIR"
set_TMPDIR
TEST_NAME="set_TMPDIR uses --tmpdir"
is "$TMPDIR" "/tmp/use--tmpdir"
TEST_NAME="set_TMPDIR creates --tmpdir"
ok "test -d $TMPDIR"
tmpdir=$TMPDIR;
TEST_NAME="rm_TMPDIR removes --tmpdir"
rm_TMPDIR
ok "test ! -d $tmpdir"