From d1b4e60ff5e4a5829cfca28d50b779986ae794c2 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 3 Jul 2020 13:31:10 +0000 Subject: 46175/0001: Add a unit test for the RM_STAR_SILENT option. --- Test/E01options.ztst | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'Test/E01options.ztst') diff --git a/Test/E01options.ztst b/Test/E01options.ztst index 70736f444..a1b564327 100644 --- a/Test/E01options.ztst +++ b/Test/E01options.ztst @@ -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} -- cgit 1.4.1