mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Backport ksh93v- regression tests and fix various regression test bugs (#472)
- tests/*.sh: Backported many additional regression tests and test fixes from the alpha and beta releases of ksh93v-. - tests/alias.sh: Avoid trying to add vi to the hash table, as some platforms do not provide a vi(1) implementation installed as part of the default system. This fixes a regression test failure I was getting in one of my Linux virtual machines. - tests/builtins.sh: Fixed a bug in one of the regression tests that caused an incorrect total error count if any of the tests failed. - tests/sh_match.sh: Fixed a regression test failure on DragonFly BSD caused by the diff command printing an extra 'No differences encountered' line.
This commit is contained in:
parent
bb3527aea5
commit
dccf6b5ea8
25 changed files with 313 additions and 32 deletions
|
|
@ -57,7 +57,7 @@ done
|
|||
typeset -T X_t=( typeset name=aha )
|
||||
typeset -a[X_t] arr
|
||||
) 2> /dev/null
|
||||
[[ $? == 1 ]] || err_exit 'typeset -a[X_t] should generate an error message when X-t is not an enumeration type'
|
||||
[[ $? == 1 ]] || err_exit 'typeset -a[X_t] should generate an error message when X_t is not an enumeration type'
|
||||
|
||||
typeset -a [Color_t] arr
|
||||
arr[green]=foo
|
||||
|
|
@ -168,5 +168,27 @@ exp=': trap: is a special shell builtin'
|
|||
[[ $got == *"$exp" ]] || err_exit "enum overrides special builtin" \
|
||||
"(expected match of *$(printf %q "$exp"); got $(printf %q "$got"))"
|
||||
|
||||
# ======
|
||||
# Various tests backported from ksh93v- for enum type arrays.
|
||||
enum bool=(false true)
|
||||
bool -A a=( [2]=true [4]=false )
|
||||
exp=true
|
||||
got=${a[2]}
|
||||
[[ $got == $exp ]] || err_exit 'associative array assignment failure when using enums' \
|
||||
"(expected $(printf %q "$exp"); got $(printf %q "$got"))"
|
||||
exp=2
|
||||
got=${#a[@]}
|
||||
[[ $got == $exp ]] || err_exit 'bool -A a should only have two elements' \
|
||||
"(expected $(printf %q "$exp"); got $(printf %q "$got"))"
|
||||
|
||||
bool -a bia
|
||||
(( bia[4]=false ))
|
||||
[[ ${bia[3]} ]] && err_exit 'empty index array element should not produce a value'
|
||||
(( bia[3] == 0 )) || err_exit 'empty index array element should be numerically 0'
|
||||
bool -A baa
|
||||
(( baa[4]=false ))
|
||||
[[ ${baa[3]} ]] && err_exit 'empty associative array element should not produce a value'
|
||||
(( baa[3] == 0 )) || err_exit 'empty associative array element should be numerically 0'
|
||||
|
||||
# ======
|
||||
exit $((Errors<125?Errors:125))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue