freebsd-dev/tools/regression/usr.bin/tr/regress.sh
Jilles Tjoelker 88deede54a tr: Fix '[=]=]' equivalence class.
A closing bracket immediately after '[=' should not be treated as special.

Different from the submitted patch, a string ending with '[=' does not cause
access beyond the terminating '\0'.

PR:		bin/150384
Submitted by:	Richard Lowe
MFC after:	2 weeks
2010-09-29 22:24:18 +00:00

23 lines
979 B
Bash

# $FreeBSD$
echo 1..14
REGRESSION_START($1)
REGRESSION_TEST(`00', `tr abcde 12345 < regress.in')
REGRESSION_TEST(`01', `tr 12345 abcde < regress.in')
REGRESSION_TEST(`02', `tr -d aceg < regress.in')
REGRESSION_TEST(`03', `tr "[[:lower:]]" "[[:upper:]]" < regress.in')
REGRESSION_TEST(`04', `tr "[[:alpha:]]" . < regress.in')
REGRESSION_TEST(`05', `tr "[[:lower:]]" "[[:upper:]]" < regress.in | tr "[[:upper:]]" "[[:lower:]]"')
REGRESSION_TEST(`06', `tr "[[:digit:]]" "?" < regress2.in')
REGRESSION_TEST(`07', `tr "[[:alnum:]]" "#" < regress2.in')
REGRESSION_TEST(`08', `tr "[[:upper:]]" "[[:lower:]]" < regress2.in | tr -d "[^[:alpha:]] "')
REGRESSION_TEST(`09', `printf "\\f\\r\\n" | tr "\\014\\r" "?#"')
REGRESSION_TEST(`0a', `printf "0xdeadbeef\\n" | tr "x[[:xdigit:]]" "?\$"')
REGRESSION_TEST(`0b', `(tr -cd "[[:xdigit:]]" < regress2.in ; echo)')
REGRESSION_TEST(`0c', `echo "[[[[]]]]" | tr -d "[=]=]"')
REGRESSION_TEST(`0d', `echo "]=[" | tr -d "[=]"')
REGRESSION_END()