about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-07-09 18:31:24 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-07-09 18:31:24 +0000
commit7060b34457f579864bddbe1caa3e3cdfea6981e2 (patch)
tree928f53c3e47e536f49beb26ae15a36a41a872c0a
parent4872ed50868379e769ce905a4af3ae7dfcef09d7 (diff)
downloadzsh-7060b34457f579864bddbe1caa3e3cdfea6981e2.tar.gz
zsh-7060b34457f579864bddbe1caa3e3cdfea6981e2.tar.xz
zsh-7060b34457f579864bddbe1caa3e3cdfea6981e2.zip
15334: use string "(eval)" as script name in debugging messages in eval's
-rw-r--r--ChangeLog7
-rw-r--r--Src/builtin.c6
-rw-r--r--Test/A01grammar.ztst2
-rw-r--r--Test/A02alias.ztst2
-rw-r--r--Test/A04redirect.ztst4
-rw-r--r--Test/C01arith.ztst6
-rw-r--r--Test/D01prompt.ztst2
-rw-r--r--Test/D04parameter.ztst6
-rw-r--r--Test/D06subscript.ztst2
-rw-r--r--Test/E01options.ztst52
-rw-r--r--Test/E02xtrace.ztst42
-rw-r--r--Test/V01zmodload.ztst2
12 files changed, 73 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f39ad2a3..446337b8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2001-07-09  Peter Stephenson  <pws@csr.com>
 
+	* 15334: Src/builtin.c, Test/A01grammar.ztst, Test/A02alias.ztst,
+	Test/A04redirect.ztst, Test/C01arith.ztst, Test/D01prompt.ztst,
+	Test/D04parameter.ztst, Test/D06subscript.ztst,
+	Test/E01options.ztst, Test/E02xtrace.ztst, Test/V01zmodload.ztst:
+	Another companion piece to 15327 to use `(eval)' as the script
+	name in an eval.  This neatens the test code considerably.
+
 	* unposted: Config/version.mk: 4.1.0-dev-1.
 
 	* 15329: Test/A01grammar.ztst, Test/A02alias.ztst,
diff --git a/Src/builtin.c b/Src/builtin.c
index 9a792e15c..c5491eb6b 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3420,6 +3420,9 @@ int
 bin_eval(char *nam, char **argv, char *ops, int func)
 {
     Eprog prog;
+    char *oscriptname = scriptname;
+
+    scriptname = "(eval)";
 
     prog = parse_string(zjoin(argv, ' ', 1));
     if (!prog) {
@@ -3431,6 +3434,9 @@ bin_eval(char *nam, char **argv, char *ops, int func)
 	lastval = errflag;
 	errflag = 0;
     }
+
+    scriptname = oscriptname;
+
     return lastval;
 }
 
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index e5eb6a851..92fde369b 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -108,7 +108,7 @@
     :
   fi
 1d:`if ...' (iv)
-?ZTST_execchunk:3: parse error near `fi'
+?(eval):3: parse error near `fi'
 
   for name in word to term; do
     print $name
diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
index 1bb7223ba..61cc04bdf 100644
--- a/Test/A02alias.ztst
+++ b/Test/A02alias.ztst
@@ -16,7 +16,7 @@
 
   \foo foo
 127:Not aliasing
-?ZTST_execchunk:1: command not found: foo
+?(eval):1: command not found: foo
 
   \bar \bar
 0:Aliasing with a backslash
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index 08b67ad14..2c3bd12ca 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -189,7 +189,7 @@
   unset NULLCMD
   >out1
 1:null redir with NULLCMD unset
-?ZTST_execchunk:2: redirection with no command
+?(eval):2: redirection with no command
 
   echo this should still work >out1
   print "$(<out1)"
@@ -200,7 +200,7 @@
   print cat input >out1
   <out1
 1:READNULLCMD with NULLCMD unset
-?ZTST_execchunk:3: redirection with no command
+?(eval):3: redirection with no command
 
   NULLCMD=:
   >out1
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index 282877459..80c8a5736 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -53,11 +53,11 @@
 
   print $(( 3 ? 2 ))
 1:parsing ternary (1)
-?ZTST_execchunk:1: ':' expected
+?(eval):1: ':' expected
 
   print $(( 3 ? 2 : 1 : 4 ))
 1:parsing ternary (2)
-?ZTST_execchunk:1: ':' without '?'
+?(eval):1: ':' without '?'
 
   print $(( 0, 4 ? 3 : 1, 5 ))
 0:comma operator
@@ -91,7 +91,7 @@
 
   print $(( 13 = 42 ))
 1:bad lvalue
-?ZTST_execchunk:1: lvalue required
+?(eval):1: lvalue required
 
   x=/bar
   (( x = 32 ))
diff --git a/Test/D01prompt.ztst b/Test/D01prompt.ztst
index 377143977..1a5da8a97 100644
--- a/Test/D01prompt.ztst
+++ b/Test/D01prompt.ztst
@@ -30,7 +30,7 @@
 >  %M:  $HOST
 >  %m:  ${HOST%%.*}
 >  %n:  $USERNAME
->  %N:  ZTST_execchunk
+>  %N:  (eval)
 >  %i:  2
 >  a%{...%}b:  ab
 >  
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 3b3cda286..ace4cbc86 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -74,8 +74,8 @@
 1:${...:?...}, ${...?...}
 >set1v
 >
-?ZTST_execchunk:1: unset1: exiting1
-?ZTST_execchunk:2: null1: exiting2
+?(eval):1: unset1: exiting1
+?(eval):2: null1: exiting2
 
   print ${set1:+word1} ${set1+word2} ${null1:+word3} ${null1+word4}
   print ${unset1:+word5} ${unset1+word6}
@@ -279,7 +279,7 @@
   foo='unmatched "'
   print ${(QX)foo}
 1:${(QX)...}
-?ZTST_execchunk:2: unmatched "
+?(eval):2: unmatched "
 
   array=(characters in an array)
   print ${(c)#array}
diff --git a/Test/D06subscript.ztst b/Test/D06subscript.ztst
index ac233c1a2..d3645c636 100644
--- a/Test/D06subscript.ztst
+++ b/Test/D06subscript.ztst
@@ -95,7 +95,7 @@
 
   eval 'A[*]=star'
 1:Illegal associative array assignment
-?ZTST_execchunk:1: A: attempt to set slice of associative array
+?(eval):1: A: attempt to set slice of associative array
 
   x='*'
   A[$x]=xstar
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index 1d5fa2ad0..477e769b5 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -133,7 +133,7 @@
   print [b
 1:BAD_PATTERN option
 >[a
-?ZTST_execchunk:4: bad pattern: [b
+?(eval):4: bad pattern: [b
 
   unsetopt bareglobqual nomatch
   print *(.)
@@ -192,8 +192,8 @@
 1q:CDABLE_VARS option
 >`print -P '%~'`/tmpcd
 >back in options.tmp
-?ZTST_execchunk:cd:4: no such file or directory: cdablevar1
-?ZTST_execchunk:cd:10: no such file or directory: cdablevar2
+?(eval):cd:4: no such file or directory: cdablevar1
+?(eval):cd:10: no such file or directory: cdablevar2
 
 # CHASE_DOTS should go with CHASE_LINKS in B01cd.ztst
 # which saves me having to write it here.
@@ -227,8 +227,8 @@
 >wimpole
 >royston
 >foxton
-?ZTST_execchunk:4: file exists: foo1
-?ZTST_execchunk:6: no such file or directory: bar1
+?(eval):4: file exists: foo1
+?(eval):6: no such file or directory: bar1
 
    setopt cshjunkieloops
    eval 'for f in swaffham bulbeck; print $f; end'
@@ -239,7 +239,7 @@
 >swaffham
 >bulbeck
 ?next one should fail
-?ZTST_execchunk:1: parse error near `end'
+?(eval):1: parse error near `end'
 
   setopt cshjunkiequotes
   print this should cause an error >&2
@@ -253,7 +253,7 @@
 >line three
 >  line four
 ?this should cause an error
-?ZTST_execchunk:1: unmatched '
+?(eval):1: unmatched '
 ?this should not
 
   nullcmd() { print '$NULLCMD run'; }
@@ -279,10 +279,10 @@
 >Running $READNULLCMD
 >$NULLCMD run
 ?This should fail
-?ZTST_execchunk:8: redirection with no command
+?(eval):8: redirection with no command
 ?This should succeed
 ?This should also fail
-?ZTST_execchunk:13: redirection with no command
+?(eval):13: redirection with no command
 
 # nomatch should be overridden by cshnullglob
   setopt nomatch cshnullglob
@@ -297,7 +297,7 @@
 >tmpcd tmpfile1 tmpfile2 blah
 >tmpcd tmpfile1 tmpfile2 nothing* blah
 >nothing* blah
-?hoping for no match: ZTST_execchunk:4: no match
+?hoping for no match: (eval):4: no match
 ?
 
 # The trick is to avoid =cat being expanded in the output while $catpath is.
@@ -625,7 +625,7 @@
   print with nomatch flooble*
 1:NOMATCH option
 >with nonomatch: flooble*
-?ZTST_execchunk:4: no matches found: flooble*
+?(eval):4: no matches found: flooble*
 
 # NULL_GLOB should override NONOMATCH...
   setopt nullglob nomatch
@@ -688,7 +688,7 @@
 >File in upper dir
 >File in lower dir
 >unsetting option...
-?ZTST_execchunk:14: no such file or directory: pathtestdir/findme
+?(eval):14: no such file or directory: pathtestdir/findme
 
   setopt posixbuiltins
   command print foo
@@ -698,7 +698,7 @@
 127:POSIX_BUILTINS option
 >foo
 >unsetting...
-?ZTST_execchunk:5: command not found: print
+?(eval):5: command not found: print
 
 # This option seems to be problematic.  I don't quite know how it works.
 ##   func() {
@@ -707,7 +707,7 @@
 ##   }
 ##   func
 ## 1:PRINT_EXIT_VALUE option
-## ?ZTST_execchunk:2: exit 1
+## ?(eval):2: exit 1
 
   setopt promptbang
   print -P !
@@ -817,13 +817,13 @@
   (setopt restricted; unsetopt restricted)
   :
 0:RESTRICTED option
-?ZTST_execchunk:cd:1: restricted
-?ZTST_execchunk:2: PATH: restricted
-?ZTST_execchunk:3: /bin/ls: restricted
-?ZTST_execchunk:hash:4: restricted: /bin/ls
-?ZTST_execchunk:5: writing redirection not allowed in restricted mode
-?ZTST_execchunk:exec:6: ls: restricted
-?ZTST_execchunk:unsetopt:7: can't change option: restricted
+?(eval):cd:1: restricted
+?(eval):2: PATH: restricted
+?(eval):3: /bin/ls: restricted
+?(eval):hash:4: restricted: /bin/ls
+?(eval):5: writing redirection not allowed in restricted mode
+?(eval):exec:6: ls: restricted
+?(eval):unsetopt:7: can't change option: restricted
 
   fn() {
     print =ls ={ls,}
@@ -909,9 +909,9 @@
 >nonsense
 >nonsense
 >nonsense
-?fn:1: parse error near `print'
-?fn:1: parse error near `print'
-?fn:1: parse error near `print'
+?(eval):1: parse error near `print'
+?(eval):1: parse error near `print'
+?(eval):1: parse error near `print'
 
   fn() { print -l $*; }
   setopt shwordsplit
@@ -958,6 +958,6 @@
 0:XTRACE option
 >message
 >message
-?+ZTST_execchunk:3> fn
+?+(eval):3> fn
 ?+fn:0> print message
-?+ZTST_execchunk:4> unsetopt xtrace
+?+(eval):4> unsetopt xtrace
diff --git a/Test/E02xtrace.ztst b/Test/E02xtrace.ztst
index f1fb9edb0..2782e4e8b 100644
--- a/Test/E02xtrace.ztst
+++ b/Test/E02xtrace.ztst
@@ -54,30 +54,30 @@
 >Tracing: function 2>file
 >Tracing: source
 >Tracing: source 2>file
->+ZTST_execchunk:7> print Tracing: ( builtin ) 2>file
->+ZTST_execchunk:9> cat
->+ZTST_execchunk:11> print Tracing: { builtin } 2>file
->+ZTST_execchunk:13> cat
->+ZTST_execchunk:15> print Tracing: do builtin done 2>file
->+ZTST_execchunk:17> cat
-?+ZTST_execchunk:2> print Tracing: builtin
-?+ZTST_execchunk:3> print Tracing: builtin 2>file
-?+ZTST_execchunk:4> cat
-?+ZTST_execchunk:5> cat
-?+ZTST_execchunk:6> print Tracing: ( builtin )
-?+ZTST_execchunk:8> cat
-?+ZTST_execchunk:10> print Tracing: { builtin }
-?+ZTST_execchunk:12> cat
-?+ZTST_execchunk:14> print Tracing: do builtin done
-?+ZTST_execchunk:16> cat
-?+ZTST_execchunk:18> xtf Tracing: function
+>+(eval):7> print Tracing: ( builtin ) 2>file
+>+(eval):9> cat
+>+(eval):11> print Tracing: { builtin } 2>file
+>+(eval):13> cat
+>+(eval):15> print Tracing: do builtin done 2>file
+>+(eval):17> cat
+?+(eval):2> print Tracing: builtin
+?+(eval):3> print Tracing: builtin 2>file
+?+(eval):4> cat
+?+(eval):5> cat
+?+(eval):6> print Tracing: ( builtin )
+?+(eval):8> cat
+?+(eval):10> print Tracing: { builtin }
+?+(eval):12> cat
+?+(eval):14> print Tracing: do builtin done
+?+(eval):16> cat
+?+(eval):18> xtf Tracing: function
 ?+xtf:1> local regression_test_dummy_variable
 ?+xtf:2> print Tracing: function
-?+ZTST_execchunk:19> xtf Tracing: function 2>file
+?+(eval):19> xtf Tracing: function 2>file
 ?+xtf:1> local regression_test_dummy_variable
 ?+xtf:2> print Tracing: function 2>file
-?+ZTST_execchunk:20> . ./xt.in Tracing: source
+?+(eval):20> . ./xt.in Tracing: source
 ?+./xt.in:1> print Tracing: source
-?+ZTST_execchunk:21> . ./xt.in Tracing: source 2>file
+?+(eval):21> . ./xt.in Tracing: source 2>file
 ?+./xt.in:1> print Tracing: source 2>file
-?+ZTST_execchunk:22> set +x
+?+(eval):22> set +x
diff --git a/Test/V01zmodload.ztst b/Test/V01zmodload.ztst
index a6916dd39..fef7d0232 100644
--- a/Test/V01zmodload.ztst
+++ b/Test/V01zmodload.ztst
@@ -47,7 +47,7 @@
 
  zmodload zsh/main
 1:Test reloading an already-loaded module
-?ZTST_execchunk:zmodload:1: module zsh/main already loaded.
+?(eval):zmodload:1: module zsh/main already loaded.
 
 # Loop over the modules found above and attempt to load each one.  Use
 # the -i flag in case dependencies cause multiple modules to be loaded,