1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-10 12:40:58 +02:00

46175/0001: Add a unit test for the RM_STAR_SILENT option.

This commit is contained in:
Daniel Shahaf 2020-07-03 13:31:10 +00:00
parent 805b946b53
commit d1b4e60ff5
2 changed files with 29 additions and 1 deletions

View file

@ -1,5 +1,8 @@
2020-07-05 Daniel Shahaf <d.s@daniel.shahaf.name>
* 46175/0001: Test/E01options.ztst: Add a unit test for the
RM_STAR_SILENT option.
* 46174/0002: Test/comptest: test harness: Restore indentation
after the previous commit. No functional change.

View file

@ -57,7 +57,6 @@
# PROMPT_CR
# PUSHD_SILENT
# REC_EXACT
# RM_STAR_SILENT
# RM_STAR_WAIT
# SHARE_HISTORY
# SINGLE_LINE_ZLE
@ -92,6 +91,9 @@
catpath=$(which cat)
lspath==ls
# If the module fails to load, individual test points will skip.
zmodload zsh/zpty 2>/dev/null || true
%test
# setopt should move on to the next operation in the face of an error, but
@ -1423,3 +1425,26 @@ F:If this test fails at the first unsetopt, refer to P01privileged.ztst.
(( UID == EUID ))
fi
0:PRIVILEGED sanity check: default value is correct
if zmodload -e zsh/zpty 2>/dev/null; then
for target_dir target_pattern in \
'.' '*'
do
before=`ls -a -- $target_dir`
zpty subshell $ZTST_testdir/../Src/zsh -f
[[ $PWD == */options.tmp ]] || return 1 # Sanity check before calling rm(1).
zpty -w subshell "rm $target_pattern"
zpty -w subshell 'n'
sleep 1
zpty -rt subshell REPLY # "${PS1} rm *"
zpty -rt subshell REPLY && print -r -- ${REPLY%%$'\r\n'}
zpty -d subshell
after=`ls -a -- $target_dir`
[[ $before == $after ]] || return 1
done
else
ZTST_skip="the zsh/zpty module is not available"
fi
BEL=$'\a'
0q:RM_STAR_SILENT
*>zsh: sure you want to delete all 15 files in ${PWD:h}/options.tmp \[yn\]\? ${BEL}