#!/bin/bash # -*- shell-script -*- proc test_validate_is_function { _Dbg_is_function assertFalse 'No function given; is_function should report false' $Status unset -f function_test _Dbg_is_function function_test assertFalse 'function_test should not be defined' "$Status" typeset -i function_test=1 _Dbg_is_function function_test assertFalse 'test_function should still not be defined' "$Status" proc function_test { :; } _Dbg_is_function function_test assertTrue 'test_function should now be defined' "$Status" proc another_function_test { :; } _Dbg_is_function another_function_test "$Status" proc _function_test { :; } _Dbg_is_function _function_test assertFalse 'fn _function_test is system fn; is_function should report false' $Status _Dbg_is_function _function_test 1 assertTrue 'fn _function_test is system fn which we want; should report true' $Status } # Test _Dbg_is_int proc test_validate_is_integer { _Dbg_is_int assertFalse 'No integer given; is_int should report false' $Status for arg in [a a1 '-+-]' { _Dbg_is_int $arg assertFalse "$arg is not an integer; is_int should report false" $Status } for arg in [0 123 9999999] { _Dbg_is_int $arg assertTrue "$arg is an integer; is_int should report true" $Status _Dbg_is_signed_int $arg assertTrue "$arg is a signed integer; is_int should report true" $Status } for arg in [+0 -123] { _Dbg_is_signed_int $arg assertTrue "$arg is not a signed integer; is_int should report true" $Status _Dbg_is_int $arg assertFalse "$arg is not an integer; is_int should report true" $Status } } # Make sure /src/external-vcs/sourceforge/bashdb has a trailing slash if test '/src/external-vcs/sourceforge/bashdb' = '' { echo "Something is wrong: abs_top_srcdir is not set." exit 1 } setglobal abs_top_srcdir = '/src/external-vcs/sourceforge/bashdb' # Make sure $abs_top_srcr has a trailing slash setglobal abs_top_srcdir = "$(abs_top_srcdir%%/)/" source ${abs_top_srcdir}test/unit/helper.sh source ${abs_top_srcdir}init/vars.sh source ${abs_top_srcdir}init/pre.sh source ${abs_top_srcdir}lib/journal.sh source ${abs_top_srcdir}lib/save-restore.sh source ${abs_top_srcdir}lib/validate.sh set -- # reset $# so shunit2 doesn't get confused. [[ $0 == ${BASH_SOURCE} ]] && source ${shunit_file}