about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-06-20 19:59:11 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-06-20 19:59:11 +0100
commitb7b67d456e40183d952fa0c7793367ebbc6e320c (patch)
treea8da40c0d444dbcaf571507d8ddb86a1a8c21084
parent2dcd766f6292963256d3b1c585e7dc07b14512c1 (diff)
downloadzsh-b7b67d456e40183d952fa0c7793367ebbc6e320c.tar.gz
zsh-b7b67d456e40183d952fa0c7793367ebbc6e320c.tar.xz
zsh-b7b67d456e40183d952fa0c7793367ebbc6e320c.zip
Fix remaining existing tests.
XTRACE output for builtins with assignment arguments added.
Note difference as the output is assignment-like too:
  'foo=<squggle><squiggle>bar'
now appears as
  foo='<squiggle><squiggle>bar'

Remove stupid "int htok" that stopped name part of scalar being expanded.

Rewrite KSH_TYPESET test to use old builtin interface where this applies.
-rw-r--r--Src/builtin.c22
-rw-r--r--Src/exec.c1
-rw-r--r--Test/D01prompt.ztst2
-rw-r--r--Test/E01options.ztst11
4 files changed, 34 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 6cccf5330..5eb7bfb45 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -443,6 +443,28 @@ execbuiltin(LinkList args, LinkList assigns, Builtin bn)
 	        fputc(' ', xtrerr);
 	        quotedzputs(*fullargv++, xtrerr);
 	    }
+	    if (assigns) {
+		LinkNode node;
+		for (node = firstnode(assigns); node; incnode(node)) {
+		    Asgment asg = (Asgment)node;
+		    fputc(' ', xtrerr);
+		    quotedzputs(asg->name, xtrerr);
+		    if (asg->is_array) {
+			LinkNode arrnode;
+			fprintf(xtrerr, "=(");
+			for (arrnode = firstnode(asg->value.array);
+			     arrnode;
+			     incnode(arrnode)) {
+			    fputc(' ', xtrerr);
+			    quotedzputs((char *)getdata(arrnode), xtrerr);
+			}
+			fprintf(xtrerr, " )");
+		    } else if (asg->value.scalar) {
+			fputc('=', xtrerr);
+			quotedzputs(asg->value.scalar, xtrerr);
+		    }
+		}
+	    }
 	    fputc('\n', xtrerr);
 	    fflush(xtrerr);
 	}
diff --git a/Src/exec.c b/Src/exec.c
index 967f86e23..6066d5525 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3488,7 +3488,6 @@ execcmd(Estate state, int input, int output, int how, int last1)
 			wordcode ac = *state->pc++;
 			char *name = ecgetstr(state, EC_DUPTOK, &htok);
 			Asgment asg;
-			int htok;
 			local_list1(svl);
 
 			DPUTS(wc_code(ac) != WC_ASSIGN,
diff --git a/Test/D01prompt.ztst b/Test/D01prompt.ztst
index 3074efe60..2638e2438 100644
--- a/Test/D01prompt.ztst
+++ b/Test/D01prompt.ztst
@@ -199,5 +199,5 @@
 ?+zsh_directory_name:4> [[ d == n ]]
 ?+zsh_directory_name:12> [[ <parent>/very_long_directory_name == (#b)(*)/very_long_directory_name ]]
 ?+zsh_directory_name:14> return 0
-?+fn:7> local 'd=~[<parent>:l]'
+?+fn:7> local d='~[<parent>:l]'
 ?+fn:8> print '~[<parent>:l]'
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index d64f7ac68..ca3f06ca8 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -570,6 +570,15 @@
 >unset
 >globassign
 
+  # This test is now somewhat artificial as
+  # KSH_TYPESET only applies to the builtin
+  # interface.  Tests to the more standard
+  # reserved word interface appear elsewhere.
+  (
+  # reserved words are handled during parsing,
+  # hence eval...
+  disable -r typeset
+  eval '
   setopt kshtypeset
   ktvars=(ktv1 ktv2)
   typeset ktfoo=`echo arg1 arg2` $ktvars
@@ -580,6 +589,8 @@
   print $noktfoo
   print $+noktarg1 $+noktarg2
   unset ktfoo ktv1 ktv2 noktfoo noktarg2
+  '
+  )
 0:KSH_TYPESET option
 >1 1 0
 >arg1 arg2