sh: Add testcases that should not be broken by future optimizations.

This commit is contained in:
Jilles Tjoelker 2012-01-14 23:10:18 +00:00
parent 93431cb74c
commit d0766f8d45
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=230121
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,6 @@
# $FreeBSD$
f() {
echo x$(printf foo >&2)y
}
[ "$(f 2>&1)" = "fooxy" ]

View File

@ -0,0 +1,12 @@
# $FreeBSD$
x=1 y=2
[ "$(
case $((x+=1)) in
($((y+=1))) echo bad1 ;;
($((y-1))) echo $x.$y ;;
($((y=2))) echo bad2 ;;
(*) echo bad3 ;;
esac
)" = "2.3" ] || echo "Error at $LINENO"
[ "$x.$y" = "1.2" ] || echo "Error at $LINENO"