about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 2d5489c21..f032230b6 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5818,17 +5818,19 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func)
     testlex();
     prog = parse_cond();
     condlex = zshlex;
-    lexrestore();
 
     if (errflag) {
 	errflag = 0;
+	lexrestore();
 	return 1;
     }
 
     if (!prog || tok == LEXERR) {
 	zwarnnam(name, tokstr ? "parse error" : "argument expected");
+	lexrestore();
 	return 1;
     }
+    lexrestore();
 
     if (*curtestarg) {
 	zwarnnam(name, "too many arguments");