about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Test/E01options.ztst27
2 files changed, 29 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4800cbd5f..30863e3f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
 
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}