From 38654f09462091cd759e5b686cca61004cb38a63 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Wed, 5 May 2021 03:51:40 +0100 Subject: [PATCH] tests/builtins.sh: fix disabled 'read -s' test src/cmd/ksh93/tests/builtins.sh: - An original AT&T test for 'read -s' was disabled and marked FIXME. Fix the invalid invocation and check that 'read -s' actually writes to the history file. - Remove a temporary 'command -p ls' debug test that I accidentally committed (re: a197b042). --- src/cmd/ksh93/tests/builtins.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cmd/ksh93/tests/builtins.sh b/src/cmd/ksh93/tests/builtins.sh index f78bb001c..4af7c6589 100755 --- a/src/cmd/ksh93/tests/builtins.sh +++ b/src/cmd/ksh93/tests/builtins.sh @@ -267,10 +267,13 @@ x2=.000000001 if [[ $(printf "%g\n" x2 2>/dev/null) != 1e-09 ]] then err_exit 'printf "%g" not working correctly' fi -#FIXME#($SHELL read -s foobar <<\! -#FIXME#testing -#FIXME#! -#FIXME#) 2> /dev/null || err_exit ksh read -s var fails + +(read -s foobar << /dev/null || err_exit "'read -s var' fails" +exp=$'^[[:digit:]]+\ttesting_read_s$' +got=$(fc -l -0) +[[ $got =~ $exp ]] || err_exit "'read -s' did not write to history file" \ + "(expected match of regex $(printf %q "$exp"), got $(printf %q "$got"))" + if [[ $(printf +3 2>/dev/null) != +3 ]] then err_exit 'printf is not processing formats beginning with + correctly' fi @@ -769,7 +772,6 @@ printf '\\\000' | read -r -d '' # ====== # BUG_CMDSPASGN: Preceding a special builtin with 'command' should disable its special properties. # Test that assignments preceding 'command' are local. -command -p ls for arg in '' -v -V -p -x do for cmd in '' : true ls eval 'eval :' 'eval true' 'eval ls'