########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1982-2012 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# David Korn <dgk@research.att.com> #
# #
########################################################################
function err_exit
{
print -u2 -n "\t"
let Errors+=1
}
alias err_exit='err_exit $LINENO'
integer Errors=0
{
x=abc
if [[ $x != abcdef ]]
then err_exit 'abc+def != abcdef'
fi
integer i=3
if (( i != 7 ))
then err_exit '3+4!=7'
fi
if [[ ${iarray[@]} != 'one two three four five six' ]]
then err_exit 'index array append fails'
fi
unset iarray
if [[ ${iarray[@]} != 'one four five six' ]]
then err_exit 'index array append to scalar fails'
fi
typeset -A aarray
then err_exit 'associative array append fails'
fi
if [[ ${#aarray[@]} != 5 ]]
then err_exit 'number of elements of associative array append fails'
fi
point=(x=1 y=2)
point+=( y=3 z=4)
if [[ ${point.y} != 3 ]]
then err_exit 'compound append fails'
fi
if [[ ${point.x} != 1 ]]
then err_exit 'compound append to compound variable unsets existing variables'
fi
unset foo
if [[ ${foo[@]} != 'one two' ]]
then err_exit 'array append to non array variable fails'
fi
unset foo
foo+=(x=4)
unset foo
foo=a
foo+=''
unset x z arr
typeset -a x=(a b)
x+=(c d)
exp='typeset -a x=(a b c d)'
typeset -a arr=(a=b b=c)
arr+=(c=d d=e)
exp='typeset -a arr=(a\=b b\=c c\=d d\=e)'
exp='typeset -a z=(a\=b b\=c d\=3 e f\=l)'
typeset -a z=(a=b b=c)
unset arr2
exp='typeset -a arr2=(b\=c :)'
typeset -a arr2
arr2+=(b=c :)
unset arr2
exp='typeset -a arr2=(b\=c xxxxx)'
typeset -a arr2
{