Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Use null prompts in interactive tests.



Adopt the same null prompt trick (and formatting) in all interactive tests. Hopefully future interactive test writers will copy one of them, like I did when I wrote mine in K01nameref.zest.

- Use null prompts in interactive tests

Philippe

diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
index 1c6969e74..f866ab4d1 100644
--- a/Test/A02alias.ztst
+++ b/Test/A02alias.ztst
@@ -58,30 +58,26 @@
 >And this too
 >And aliases are expanded
 
-  $ZTST_testdir/../Src/zsh -fis <<<'
-  unsetopt PROMPT_SP
-  PROMPT="" PS2="" PS3="" PS4="" RPS1="" RPS2=""
-  exec 2>&1
-  alias \{=echo
-  { begin
-  {end
-  fc -l -2' 2>/dev/null
+  PS1= $ZTST_testdir/../Src/zsh -fis <<<'
+    alias \{=echo
+    { begin
+    {end
+    fc -l -2
+  '
 0:Aliasing reserved tokens
 >begin
 >end
-*>*5*{ begin
-*>*6*{end
-
-  $ZTST_testdir/../Src/zsh -fis <<<'
-  unsetopt PROMPT_SP
-  PROMPT="" PS2="" PS3="" PS4="" RPS1="" RPS2=""
-  exec 2>&1
-  alias -g S=\"
-  echo S a string S "
-  fc -l -1' 2>/dev/null
+*>*2*{ begin
+*>*3*{end
+
+  PS1= $ZTST_testdir/../Src/zsh -fis <<<'
+    alias -g S=\"
+    echo S a string S "
+    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..3a6e1eb09 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -108,19 +108,16 @@
 ?(eval):1: unset1: exiting1
 ?(eval):2: null1: exiting2
 
-  PROMPT="" $ZTST_testdir/../Src/zsh -fis <<<'
-  unsetopt PROMPT_SP
-  PS1="" PS2="" PS3="" PS4="" RPS1="" RPS2=""
-  exec 2>&1
-  foo() {
-      print ${1:?no arguments given}
-      print not reached
-  }
-  foo
-  print reached
-  ' 2>/dev/null
+  PS1= PS2= $ZTST_testdir/../Src/zsh -fis <<<'
+    foo() {
+        print ${1:?no arguments given}
+        print not reached
+    }
+    foo 2>&1
+    print reached
+  '
 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..aadd01f11 100644
--- a/Test/K01nameref.ztst
+++ b/Test/K01nameref.ztst
@@ -1541,39 +1541,37 @@ 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
- () {
-  typeset -p p
-  local p
-  typeset -p p
-  p=xx
-  typeset -p p
- }
+ PS1= PS2= $ZTST_testdir/../Src/zsh -fis <<<'
+   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=PS1
+>typeset -g -n p=PS3
 >typeset p=''
 >typeset p=xx
-*?*
 
  # Note bypassing TYPESET_TO_UNSET here
- $ZTST_testdir/../Src/zsh -fis <<<$'
- () {
-   typeset p=PS1
-   typeset -n p
-   p=zz
- }
- typeset -p PS1
+ PS1= PS2= $ZTST_testdir/../Src/zsh -fis <<<'
+   () {
+     typeset p=PS3
+     typeset -n p
+     p=zz
+   }
+   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..665a37f2c 100644
--- a/Test/W01history.ztst
+++ b/Test/W01history.ztst
@@ -6,26 +6,26 @@
 
 %test
 
-  $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
+  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
+  '
 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 <<<'
-  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
+  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-$
+  '
 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 <<<'
-  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
+  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/
+  '
 0:History substitution
 >All metaphor, Malachi, stilts and all
 >metaphor? shmetaphor!
@@ -47,10 +47,11 @@
 >metophor,
 >Molochi,
 
-  $ZTST_testdir/../Src/zsh -fis <<<'
-  echo foo bar
-  echo $(!!) again
-  echo more $( !! )' 2>/dev/null
+  PS1= $ZTST_testdir/../Src/zsh -fis <<<'
+    echo foo bar
+    echo $(!!) again
+    echo more $( !! )
+  '
 0:Regression test for history references in command substitution
 >foo bar
 >foo bar again
@@ -59,17 +60,18 @@
 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 <<<'
- 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' 2>/dev/null
+ 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
+ '
 0:Modifiers :h and :t with arguments
 >/my/path/for/testing
 >/my/path/for/testing
@@ -82,26 +84,28 @@ F:Check that a history bug introduced by workers/34160 is working again.
 >testing
 >path/for
 
- $ZTST_testdir/../Src/zsh -fis <<<'
- echo /my/path/for/testing
- echo !1:1:P' 2>/dev/null
+ PS1= $ZTST_testdir/../Src/zsh -fis <<<'
+   echo /my/path/for/testing
+   echo !1:1:P
+ '
 0:Modifier :P
 >/my/path/for/testing
 >/my/path/for/testing
 
- $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' 2>/dev/null
+ 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
+ '
 0:Lines ending in backslash saved and restored to history
 >    1  one\
 >    2  two\\


Messages sorted by: Reverse Date, Date, Thread, Author