Update of /cvsroot/wigwam/wigwam-base/sh-macros/wigwam-env-api-tests
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv25766/sh-macros/wigwam-env-api-tests
Modified Files:
Makefile.am
Added Files:
ww_default
Log Message:
added new ww_default to ww-env-api its basicly:
test "x$VAR" = "x" && VAR=VALUE
only set variable if its not set
Index: Makefile.am
===================================================================
RCS file: /cvsroot/wigwam/wigwam-base/sh-macros/wigwam-env-api-tests/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile.am 3 Nov 2005 23:20:03 -0000 1.4
--- Makefile.am 21 Oct 2008 22:12:18 -0000 1.5
***************
*** 13,17 ****
ww_int_pre_colon \
ww_usage \
! ww_set
EXTRA_DIST=$(TESTS) test_functions
--- 13,18 ----
ww_int_pre_colon \
ww_usage \
! ww_set \
! ww_default
EXTRA_DIST=$(TESTS) test_functions
--- NEW FILE: ww_default ---
#!/bin/sh
. $srcdir/../ww-env-api
. $srcdir/test_functions
# ww_int
# check_new_value VAR VALUE
check_new_value () {
ww_default "$1" "$2"
eval 'compare $'"$1"' $2'
}
# check_old_value VAR VALUE
check_old_value () {
eval "old_value=\$$1"
ww_default "$1" "$2"
eval 'compare $'"$1"' $old_value'
}
set -x
foo=""
check_new_value foo bar
check_old_value foo taco
|