Skip to content

Commit

Permalink
regress: fix tests for xtrace (re: d2bb701, 3c222cc, 2369cba)
Browse files Browse the repository at this point in the history
  • Loading branch information
McDutchie committed Oct 30, 2024
1 parent c55f94d commit 85ba71b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cmd/ksh93/tests/arith.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ got=$( ( ulimit -c 0; set +x; eval '{ (( }; echo end; }' ) 2>&1 )
"(expected status 1 and match of *$(printf %q "$exp")," \
"got status $e$( ((e>128)) && print -n /SIG && kill -l "$e") and $(printf %q "$got"))"

got=$( ( ulimit -c 0; set +x; eval '{ (( $(( 1 )) )); }' ) 2>&1 )
got=$( set +x; ( ulimit -c 0; eval '{ (( $(( 1 )) )); }' ) 2>&1 )
[[ e=$? -eq 0 && -z $got ]] || err_exit "matched '((' in compound command" \
"(expected status 0 and ''," \
"got status $e$( ((e>128)) && print -n /SIG && kill -l "$e") and $(printf %q "$got"))"
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/ksh93/tests/options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,13 @@ if ((!SHOPT_SCRIPTONLY)); then
print $'v=$(. ./dotfile)\n(. ./dotfile)\ncat <(. ./dotfile)\n. ./dotfile' > envfile
# dot scripts sourced from profile files are parsed line by line, so that aliases take effect on the next line in the same file
print $'alias print=:\nprint fail:subshell==${.sh.subshell} >&2' > dotfile
got=$(ENV=/.$PWD/envfile "$SHELL" -i -c : 2>&1)
got=$(set +x; ENV=/.$PWD/envfile "$SHELL" -i -c : 2>&1)
exp=''
[[ $got == "$exp" ]] || err_exit 'dot script sourced from profile does not process aliases correctly' \
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
# $0 does not change in ksh functions within profile scripts
print 'function BAD { echo $0; }; BAD >&2' > dotfile
got=$(ENV=/.$PWD/envfile "$SHELL" -i -c : 2>&1)
got=$(set +x; ENV=/.$PWD/envfile "$SHELL" -i -c : 2>&1)
exp=$SHELL$'\n'$SHELL$'\n'$SHELL$'\n'$SHELL
[[ $got == "$exp" ]] || err_exit '$0 in ksh function in profile script not correct' \
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
Expand Down Expand Up @@ -652,7 +652,7 @@ done
# ======
# showme only printed the first redirection in a list
# https://github.com/ksh93/ksh/issues/753
got=$(set +x --showme; eval ';true >/dev/null 2>&1 3>&1 4>&3' 2>&1)
got=$(set +x --showme; PS4='+ '; eval ';true >/dev/null 2>&1 3>&1 4>&3' 2>&1)
exp=$'+ true\n+ 1> /dev/null 2>& 1 3>& 1 4>& 3'
[[ $got == "$exp" ]] || err_exit "showme doesn't print redirects properly" \
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
Expand Down

0 comments on commit 85ba71b

Please sign in to comment.