Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Use null prompts in interactive tests.
- X-seq: zsh-workers 54806
- From: Philippe Altherr <philippe.altherr@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Use null prompts in interactive tests.
- Date: Thu, 18 Jun 2026 21:28:04 +0200
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=FuoiK8RIh/Tt5JnESk3vAQnpJ0hjsk1kOovKAKJxsr0=; fh=vuDAGjptCPc/P1/HEZ3j98yPJEW1XjuEoEAmmwDS/+U=; b=FP0JiKe4q+vR02wpgQNo7RJ5P671AtdSTXTH31ZeRTZ8AQFqfMYifRCSeAV0E8+xwi AaWQuglGZwPhNb/HPhR7nN4LAfMWeOX6SyXgha9ZWklyciAwAfW+lfvPEF1p21qtDxF6 HtsNUkemTN4TJXrjCQkV2Dp+GB8ifLsrxptuo0zL+JQGcp7311ZRa/ebmuXjSvdw5PjV fWACqWo+pvS5KovOYmM7/wDZlBXBkixABuSvBJUZXYGmeYu5OZmRj496F2/ElIHKhiDH KvMThNXU9QbrqenoVKogFN9a1RTZIsXBF0UTRve9Z8IJ/5zE6wF+b4YpPM+Uctqzd77e Oogw==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1781810897; cv=none; d=google.com; s=arc-20240605; b=TEALVaEyoOg/sXYBi/cc9pSfzaDZT76LjAWdi1ygvui97y5UBrYZqmBOQIFvwkdz/U JW3yznkYuXVwjH5gQwpfVHqjIkg05/NdNMyHJargBYjcPGXt1WjXYbtLSVZ5WGDEqjBa 0h6NChIt6w1E6Z9doV95BTgewVGB+0hkjOEtUrtISKo6Nj5cmW5grs+l4/yTxoqTGF0z aFzKhvxYj7BEZxnp6hRkh1oAdCT9TI+XWyz2k/8Q9WtsKDgNTTzdNBmqCWWrU1WEBTjq xjVH1E58c5b8mAmzTJACz1yBcd9gd/AutRW2n3k8UNa3bGA1Xc4X1eO/WpZ5h9Jo/ElL U+JA==
- Archived-at: <https://zsh.org/workers/54806>
- In-reply-to: <CAH+w=7Z_6FkhxM74=qZQ1qB=quLEfMOhNNCT=EhMWPH2OoLHWg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGdYchusW-PMac+x-sAGjmeO-puP1AENB-8norj73gDUKLwT2Q@mail.gmail.com> <CAH+w=7Z_6FkhxM74=qZQ1qB=quLEfMOhNNCT=EhMWPH2OoLHWg@mail.gmail.com>
Would it be possible to separate the functional changes from the
formatting changes to make it easier to see the actual differences?
I have split the patch into a functional part and a formatting part:
I'm also unsure that changing tests where a similar technique was
already being used (e.g., PS1=%%) is necessarily an improvement, but I
won't object if no one else does.
The external PS1= has the advantage that you no longer need a blanket *?*%* which I think could for example potentially swallow DPUTS messages.
Philippe
diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
index 1c6969e74..90f9e7c72 100644
--- a/Test/A02alias.ztst
+++ b/Test/A02alias.ztst
@@ -58,30 +58,24 @@
>And this too
>And aliases are expanded
- $ZTST_testdir/../Src/zsh -fis <<<'
- unsetopt PROMPT_SP
- PROMPT="" PS2="" PS3="" PS4="" RPS1="" RPS2=""
- exec 2>&1
+ PS1= $ZTST_testdir/../Src/zsh -fis <<<'
alias \{=echo
{ begin
{end
- fc -l -2' 2>/dev/null
+ fc -l -2'
0:Aliasing reserved tokens
>begin
>end
-*>*5*{ begin
-*>*6*{end
+*>*2*{ begin
+*>*3*{end
- $ZTST_testdir/../Src/zsh -fis <<<'
- unsetopt PROMPT_SP
- PROMPT="" PS2="" PS3="" PS4="" RPS1="" RPS2=""
- exec 2>&1
+ PS1= $ZTST_testdir/../Src/zsh -fis <<<'
alias -g S=\"
echo S a string S "
- fc -l -1' 2>/dev/null
+ fc -l -1'
0:Global aliasing quotes
> a string S
-*>*5*echo S a string S "
+*>*2*echo S a string S "
# "
# Note there is a trailing space on the "> a string S " line
diff --git a/Test/B06fc.ztst b/Test/B06fc.ztst
index 922b0010f..31ec27087 100644
--- a/Test/B06fc.ztst
+++ b/Test/B06fc.ztst
@@ -10,16 +10,13 @@
1:Checking that fc -l foo doesn't core dump when history is empty
?./fcl:fc:1: event not found: foo
- PS1='%% ' $ZTST_testdir/../Src/zsh +Z -fsi <<< $'fc -p /dev/null 0 0\n:'
+ PS1= $ZTST_testdir/../Src/zsh +Z -fsi <<< $'fc -p /dev/null 0 0\n:'
0:Checking that fc -p doesn't core dump when history size is zero
-*?*%*
- PS1='%% ' $ZTST_testdir/../Src/zsh +Z -fsi <<< 'fc -p /dev/null a 0'
+ PS1= $ZTST_testdir/../Src/zsh +Z -fsi <<< 'fc -p /dev/null a 0'
1:Checking that fc -p rejects non-integer history size
-*?*% fc: HISTSIZE must be an integer
-*?*%*
+?fc: HISTSIZE must be an integer
- PS1='%% ' $ZTST_testdir/../Src/zsh +Z -fsi <<< 'fc -p /dev/null 0 a'
+ PS1= $ZTST_testdir/../Src/zsh +Z -fsi <<< 'fc -p /dev/null 0 a'
1:Checking that fc -p rejects non-integer history save size
-*?*% fc: SAVEHIST must be an integer
-*?*%*
+?fc: SAVEHIST must be an integer
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index e44af8ad7..6e7943def 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -108,9 +108,7 @@
?(eval):1: unset1: exiting1
?(eval):2: null1: exiting2
- PROMPT="" $ZTST_testdir/../Src/zsh -fis <<<'
- unsetopt PROMPT_SP
- PS1="" PS2="" PS3="" PS4="" RPS1="" RPS2=""
+ PS1= PS2= $ZTST_testdir/../Src/zsh -fis <<<'
exec 2>&1
foo() {
print ${1:?no arguments given}
@@ -118,9 +116,9 @@
}
foo
print reached
- ' 2>/dev/null
+ '
0:interactive shell returns to top level on ${...?...} error
-*>*foo:1: 1: no arguments given
+>foo:1: 1: no arguments given
>reached
message="expand me and remove quotes"
diff --git a/Test/K01nameref.ztst b/Test/K01nameref.ztst
index 6cfe6d1d0..ec6239b54 100644
--- a/Test/K01nameref.ztst
+++ b/Test/K01nameref.ztst
@@ -1541,13 +1541,13 @@ F:previously this could create an infinite recursion and crash
>tst aaa
#
-# The following tests are run in interactive mode, using PS1 as an
+# The following tests are run in interactive mode, using PS3 as an
# assignable special with side-effects. This crashed at one time.
#
# Note bypassing TYPESET_TO_UNSET here
- $ZTST_testdir/../Src/zsh -fis <<<$'
- typeset -n p=PS1
+ PS1= PS2= $ZTST_testdir/../Src/zsh -fis <<<'
+ typeset -n p=PS3
() {
typeset -p p
local p
@@ -1557,23 +1557,21 @@ F:previously this could create an infinite recursion and crash
}
'
0:regression: assign to local that shadows global named reference
->typeset -g -n p=PS1
+>typeset -g -n p=PS3
>typeset p=''
>typeset p=xx
-*?*
# Note bypassing TYPESET_TO_UNSET here
- $ZTST_testdir/../Src/zsh -fis <<<$'
+ PS1= PS2= $ZTST_testdir/../Src/zsh -fis <<<'
() {
- typeset p=PS1
+ typeset p=PS3
typeset -n p
p=zz
}
- typeset -p PS1
+ typeset -p PS3
'
0:regression - converting a string into a named reference
->typeset PS1=zz
-*?*
+>typeset PS3=zz
unset var1 var2
typeset -n ref1=var1
diff --git a/Test/W01history.ztst b/Test/W01history.ztst
index 1d3f3cf6f..06a8556b9 100644
--- a/Test/W01history.ztst
+++ b/Test/W01history.ztst
@@ -6,26 +6,26 @@
%test
- $ZTST_testdir/../Src/zsh -fis <<<'
+ PS1= $ZTST_testdir/../Src/zsh -fis <<<'
print one two three four five six seven eight nine ten
print !:$ !:10 !:9 !:1 !:0
print one two three four five six seven eight nine ten
print !:0-$ !:1-2
- ' 2>/dev/null
+ '
0:History word references
>one two three four five six seven eight nine ten
>ten ten nine one print
>one two three four five six seven eight nine ten
>print one two three four five six seven eight nine ten one two
- $ZTST_testdir/../Src/zsh -fis <<<'
+ PS1= $ZTST_testdir/../Src/zsh -fis <<<'
print line one of an arbitrary series
print issue two for some mystery sequence
print !-1:5-$
print !1:2
print !2:2
print !-3:1-$
- ' 2>/dev/null
+ '
0:History line numbering
>line one of an arbitrary series
>issue two for some mystery sequence
@@ -34,12 +34,12 @@
>two
>mystery sequence
- $ZTST_testdir/../Src/zsh -fis <<<'
+ PS1= $ZTST_testdir/../Src/zsh -fis <<<'
print All metaphor, Malachi, stilts and all
print !1:2:s/,/\\\\?/ !1:2:s/m/shm/:s/,/\!/
print !1:2:&
print -l !1:2-3:gs/a/o/
- ' 2>/dev/null
+ '
0:History substitution
>All metaphor, Malachi, stilts and all
>metaphor? shmetaphor!
@@ -47,10 +47,10 @@
>metophor,
>Molochi,
- $ZTST_testdir/../Src/zsh -fis <<<'
+ PS1= $ZTST_testdir/../Src/zsh -fis <<<'
echo foo bar
echo $(!!) again
- echo more $( !! )' 2>/dev/null
+ echo more $( !! )'
0:Regression test for history references in command substitution
>foo bar
>foo bar again
@@ -59,7 +59,7 @@
F:Check that a history bug introduced by workers/34160 is working again.
# Discarded line of error output consumes prompts printed by "zsh -i".
- $ZTST_testdir/../Src/zsh -fis <<<'
+ PS1= $ZTST_testdir/../Src/zsh -fis <<<'
echo /my/path/for/testing
echo !1:1:h10
echo !1:1:h3
@@ -69,7 +69,7 @@ F:Check that a history bug introduced by workers/34160 is working again.
echo !1:1:t3
echo !1:1:t2
echo !1:1:t1
- echo !1:1:t3:h2' 2>/dev/null
+ echo !1:1:t3:h2'
0:Modifiers :h and :t with arguments
>/my/path/for/testing
>/my/path/for/testing
@@ -82,14 +82,14 @@ F:Check that a history bug introduced by workers/34160 is working again.
>testing
>path/for
- $ZTST_testdir/../Src/zsh -fis <<<'
+ PS1= $ZTST_testdir/../Src/zsh -fis <<<'
echo /my/path/for/testing
- echo !1:1:P' 2>/dev/null
+ echo !1:1:P'
0:Modifier :P
>/my/path/for/testing
>/my/path/for/testing
- $ZTST_testdir/../Src/zsh -fgis <<<'
+ PS1= $ZTST_testdir/../Src/zsh -fgis <<<'
SAVEHIST=7
print -rs "one\\"
print -rs "two\\\\"
@@ -101,7 +101,7 @@ F:Check that a history bug introduced by workers/34160 is working again.
fc -W hist
fc -p -R hist
fc -l
- rm hist' 2>/dev/null
+ rm hist'
0:Lines ending in backslash saved and restored to history
> 1 one\
> 2 two\\
diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
index 90f9e7c72..f866ab4d1 100644
--- a/Test/A02alias.ztst
+++ b/Test/A02alias.ztst
@@ -59,10 +59,11 @@
>And aliases are expanded
PS1= $ZTST_testdir/../Src/zsh -fis <<<'
- alias \{=echo
- { begin
- {end
- fc -l -2'
+ alias \{=echo
+ { begin
+ {end
+ fc -l -2
+ '
0:Aliasing reserved tokens
>begin
>end
@@ -70,9 +71,10 @@
*>*3*{end
PS1= $ZTST_testdir/../Src/zsh -fis <<<'
- alias -g S=\"
- echo S a string S "
- fc -l -1'
+ alias -g S=\"
+ echo S a string S "
+ fc -l -1
+ '
0:Global aliasing quotes
> a string S
*>*2*echo S a string S "
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 6e7943def..be8ac2068 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -109,13 +109,13 @@
?(eval):2: null1: exiting2
PS1= PS2= $ZTST_testdir/../Src/zsh -fis <<<'
- exec 2>&1
- foo() {
- print ${1:?no arguments given}
- print not reached
- }
- foo
- print reached
+ exec 2>&1
+ foo() {
+ print ${1:?no arguments given}
+ print not reached
+ }
+ foo
+ print reached
'
0:interactive shell returns to top level on ${...?...} error
>foo:1: 1: no arguments given
diff --git a/Test/K01nameref.ztst b/Test/K01nameref.ztst
index ec6239b54..aadd01f11 100644
--- a/Test/K01nameref.ztst
+++ b/Test/K01nameref.ztst
@@ -1547,14 +1547,14 @@ F:previously this could create an infinite recursion and crash
# Note bypassing TYPESET_TO_UNSET here
PS1= PS2= $ZTST_testdir/../Src/zsh -fis <<<'
- typeset -n p=PS3
- () {
- typeset -p p
- local p
- typeset -p p
- p=xx
- typeset -p p
- }
+ typeset -n p=PS3
+ () {
+ typeset -p p
+ local p
+ typeset -p p
+ p=xx
+ typeset -p p
+ }
'
0:regression: assign to local that shadows global named reference
>typeset -g -n p=PS3
@@ -1563,12 +1563,12 @@ F:previously this could create an infinite recursion and crash
# Note bypassing TYPESET_TO_UNSET here
PS1= PS2= $ZTST_testdir/../Src/zsh -fis <<<'
- () {
- typeset p=PS3
- typeset -n p
- p=zz
- }
- typeset -p PS3
+ () {
+ typeset p=PS3
+ typeset -n p
+ p=zz
+ }
+ typeset -p PS3
'
0:regression - converting a string into a named reference
>typeset PS3=zz
diff --git a/Test/W01history.ztst b/Test/W01history.ztst
index 06a8556b9..665a37f2c 100644
--- a/Test/W01history.ztst
+++ b/Test/W01history.ztst
@@ -7,10 +7,10 @@
%test
PS1= $ZTST_testdir/../Src/zsh -fis <<<'
- print one two three four five six seven eight nine ten
- print !:$ !:10 !:9 !:1 !:0
- print one two three four five six seven eight nine ten
- print !:0-$ !:1-2
+ print one two three four five six seven eight nine ten
+ print !:$ !:10 !:9 !:1 !:0
+ print one two three four five six seven eight nine ten
+ print !:0-$ !:1-2
'
0:History word references
>one two three four five six seven eight nine ten
@@ -19,12 +19,12 @@
>print one two three four five six seven eight nine ten one two
PS1= $ZTST_testdir/../Src/zsh -fis <<<'
- print line one of an arbitrary series
- print issue two for some mystery sequence
- print !-1:5-$
- print !1:2
- print !2:2
- print !-3:1-$
+ print line one of an arbitrary series
+ print issue two for some mystery sequence
+ print !-1:5-$
+ print !1:2
+ print !2:2
+ print !-3:1-$
'
0:History line numbering
>line one of an arbitrary series
@@ -35,10 +35,10 @@
>mystery sequence
PS1= $ZTST_testdir/../Src/zsh -fis <<<'
- print All metaphor, Malachi, stilts and all
- print !1:2:s/,/\\\\?/ !1:2:s/m/shm/:s/,/\!/
- print !1:2:&
- print -l !1:2-3:gs/a/o/
+ print All metaphor, Malachi, stilts and all
+ print !1:2:s/,/\\\\?/ !1:2:s/m/shm/:s/,/\!/
+ print !1:2:&
+ print -l !1:2-3:gs/a/o/
'
0:History substitution
>All metaphor, Malachi, stilts and all
@@ -48,9 +48,10 @@
>Molochi,
PS1= $ZTST_testdir/../Src/zsh -fis <<<'
- echo foo bar
- echo $(!!) again
- echo more $( !! )'
+ echo foo bar
+ echo $(!!) again
+ echo more $( !! )
+ '
0:Regression test for history references in command substitution
>foo bar
>foo bar again
@@ -60,16 +61,17 @@ F:Check that a history bug introduced by workers/34160 is working again.
# Discarded line of error output consumes prompts printed by "zsh -i".
PS1= $ZTST_testdir/../Src/zsh -fis <<<'
- echo /my/path/for/testing
- echo !1:1:h10
- echo !1:1:h3
- echo !1:1:h2
- echo !1:1:h1
- echo !1:1:t10
- echo !1:1:t3
- echo !1:1:t2
- echo !1:1:t1
- echo !1:1:t3:h2'
+ echo /my/path/for/testing
+ echo !1:1:h10
+ echo !1:1:h3
+ echo !1:1:h2
+ echo !1:1:h1
+ echo !1:1:t10
+ echo !1:1:t3
+ echo !1:1:t2
+ echo !1:1:t1
+ echo !1:1:t3:h2
+ '
0:Modifiers :h and :t with arguments
>/my/path/for/testing
>/my/path/for/testing
@@ -83,25 +85,27 @@ F:Check that a history bug introduced by workers/34160 is working again.
>path/for
PS1= $ZTST_testdir/../Src/zsh -fis <<<'
- echo /my/path/for/testing
- echo !1:1:P'
+ echo /my/path/for/testing
+ echo !1:1:P
+ '
0:Modifier :P
>/my/path/for/testing
>/my/path/for/testing
PS1= $ZTST_testdir/../Src/zsh -fgis <<<'
- SAVEHIST=7
- print -rs "one\\"
- print -rs "two\\\\"
- print -rs "three\\\\\\"
- print -rs "four\\\\\\\\"
- print -rs "five\\\\\\\\\\"
- print -s "while false\ndo\ntrue\\\\\n && break\ndone"
- print -s "echo one\\\\\ntwo"
- fc -W hist
- fc -p -R hist
- fc -l
- rm hist'
+ SAVEHIST=7
+ print -rs "one\\"
+ print -rs "two\\\\"
+ print -rs "three\\\\\\"
+ print -rs "four\\\\\\\\"
+ print -rs "five\\\\\\\\\\"
+ print -s "while false\ndo\ntrue\\\\\n && break\ndone"
+ print -s "echo one\\\\\ntwo"
+ fc -W hist
+ fc -p -R hist
+ fc -l
+ rm hist
+ '
0:Lines ending in backslash saved and restored to history
> 1 one\
> 2 two\\
Messages sorted by:
Reverse Date,
Date,
Thread,
Author