########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1982-2010 AT&T Intellectual Property #
# and is licensed under the #
# Common Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) #
# #
# 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
null=''
if [[ ! -z $null ]]
then err_exit "-z: null string should be of zero length"
fi
if [[ -z $file ]]
fi
if [[ -a $file ]]
fi
> $file
if [[ ! -a $file ]]
fi
if [[ ! -r $file ]]
fi
if [[ ! -w $file ]]
fi
if [[ ! -w $file ]]
fi
fi
if [[ -s $file ]]
fi
if [[ ! -f $file ]]
fi
if [[ -d $file ]]
fi
if [[ ! -d . ]]
then err_exit "-d: . should not be a directory file"
fi
fi
if [[ -r $file ]]
fi
if [[ ! -O $file ]]
fi
if [[ -w $file ]]
fi
if [[ -w $file ]]
fi
fi
if [[ -z x && -z x || ! -z x ]]
then :
else err_exit " wrong precedence"
fi
if [[ -z x && (-z x || ! -z x) ]]
then err_exit " () grouping not working"
fi
then err_exit "foo comes before bar"
fi
set -o allexport
if [[ -n $null ]]
fi
fi
fi
sleep 1
then err_exit "$file should be older than $newer_file"
fi
then err_exit "$newer_file should be newer than $file"
fi
fi
fi
(exit 8)
then err_exit 'value $? within [[...]]'
fi
x='(x'
if [[ '(x' != '('* ]]
then err_exit " '(x' does not match '('* within [[...]]"
fi
if [[ '(x' != "("* ]]
then err_exit ' "(x" does not match "("* within [[...]]'
fi
if [[ '(x' != \(* ]]
then err_exit ' "(x" does not match \(* within [[...]]'
fi
if [[ 'x(' != *'(' ]]
then err_exit " 'x(' does not match '('* within [[...]]"
fi
if [[ 'x&' != *'&' ]]
then err_exit " 'x&' does not match '&'* within [[...]]"
fi
if [[ 'xy' = *'*' ]]
then err_exit " 'xy' matches *'*' within [[...]]"
fi
if [[ 3 > 4 ]]
then err_exit '3 < 4'
fi
if [[ 4 < 3 ]]
then err_exit '3 > 4'
fi
if [[ 3x > 4x ]]
then err_exit '3x < 4x'
fi
x='bin|dev|?'
cd /
if [[ $(print $x) != "$x" ]]
then err_exit 'extended pattern matching on command arguments'
fi
if [[ dev != $x ]]
then err_exit 'extended pattern matching not working on variables'
fi
if [[ -u $SHELL ]]
fi
if [[ -g $SHELL ]]
fi
if [[ '!' != ! ]]
then err_exit 'quoting unary operator not working'
fi
exec 4> $file
if [[ ! -s $file ]]
fi
exec 4>&-
then err_exit "leading zeros in arithmetic compares not ignored"
fi
{
set -x
set +x
(
eval "[[ (a) ]]"
> $file
then err_exit "test ! -u suidfile not working"
fi
for i in '(' ')' '[' ']'
do [[ $i == $i ]] || err_exit "[[ $i != $i ]]"
done
(
{
sleep 2
print 'hello world'
sleep 2
read
fi
$SHELL -c 't=1234567890; [[ $t == @({10}(\d)) ]]' 2> /dev/null || err_exit ' @({10}(\d)) pattern not working'
$SHELL -c '[[ att_ == ~(E)(att|cus)_.* ]]' 2> /dev/null || err_exit ' ~(E)(att|cus)_* pattern not working'
[[ $e ]] && err_exit "[ ... ] compatibility check failed -- $e"
i=hell
[[ $($SHELL -c 'case F in ~(Eilr)[a-z0-9#]) print ok;;esac' 2> /dev/null) == ok ]] || err_exit '~(Eilr) not working in case command'
[[ $($SHELL -c "case Q in ~(Fi)q | \$'\E') print ok;;esac" 2> /dev/null) == ok ]] || err_exit '~(Fi)q | \E not working in case command'
export LC_COLLATE=$l
set -- \
'A' 0 1 1 0 1 1 1 0 0 1 0 0 \
'Z' 0 1 1 0 1 1 1 0 0 1 0 0 \
'/' 0 0 0 0 0 0 1 1 1 1 1 1 \
'.' 0 0 0 0 0 0 1 1 1 1 1 1 \
'_' 0 0 0 0 0 0 1 1 1 1 1 1 \
'-' 1 1 1 1 1 1 0 0 0 0 0 0 \
'%' 0 0 0 0 0 0 1 1 1 1 1 1 \
'@' 0 0 0 0 0 0 1 1 1 1 1 1 \
'!' 0 0 0 0 0 0 1 1 1 1 1 1 \
'^' 0 0 0 0 0 0 1 1 1 1 1 1 \
# retain this line #
while (( $# >= 13 ))
do c=$1
shift
for p in \
'[![.-.]]' \
'[![.-.][:upper:]]' \
'[![.-.]A-Z]' \
'[!-]' \
'[!-[:upper:]]' \
'[!-A-Z]' \
'[[.-.]]' \
'[[.-.][:upper:]]' \
'[[.-.]A-Z]' \
'[-]' \
'[-[:upper:]]' \
'[-A-Z]' \
# retain this line #
do e=$1
shift
[[ $c == $p ]]
g=$?
[[ $g == $e ]] || err_exit "[[ '$c' == $p ]] for LC_COLLATE=$l failed -- expected $e, got $g"
done
done
done
integer n
then [[ -t $n ]] || err_exit "[[ -t n ]] fails when n > 9"
fi
foo=([1]=a [2]=b [3]=c)
unset foo[1]
bar=(a b c)
unset bar[1]
integer z=( 1 2 4)
unset z[1]
typeset -si y=( 1 2 4)
unset y[1]
x=abc
unset x
[[ ${x[@]+x} ]] && err_exit '${x[@]+x} should be Empty'