Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: more _arguments tests
- X-seq: zsh-workers 39622
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: more _arguments tests
- Date: Thu, 13 Oct 2016 01:13:01 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1476313981; bh=8EUVjaC1LJ9ZjNk6voKst01CCiS6BPNtXxQg1kN6opA=; h=From:To:Subject:Date:From:Subject; b=T/aoXIy9RzoqeaIy1KhGJ3Yo05I+d+zSZuV2ajt64TKrP8OR7Wa9uOLeY+0kxo6dUifBwc90g5hFaQnwI6ZLPhklZez1vN4dlNZov7f/n3SsT5AcIn8kvhtgfcb7o2xNf6Pg6soxIT9qhuPtTSgcZPSylNqbQM7/HhBZurcj04BAnusO+A+BVB6v1H+0O0TnbUSEHwoRcpG11XnYkSHWS3TrfIv5N8ZmkSPFzmB/oyfH6pwsGLxPxQrV2tPxYBYbXcrUdJoKpXTsQzsl5h9oR4OeHmQdR0jOqrBWu9IG1WgcXCtgxvcnvNkdCJMZrH+3KaZiNsUN2CSNYhREoXuwsw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This adds tests covering the two fixes I've made recently plus Daniel's
fix for opt_args quoting. There's also tests covering exclusion lists
and -A/-S options. When applying exclusion lists, _arguments should
ideally look forward on the line with the opposite logic applying.
So with '(-b)-a' '-b', -a would not be completed if -b appears later on
the line.
Does anyone know how to get gcov working with source files from zsh
modules? It doesn't seem to like computil.c having been compiled to
computil..o.
Oliver
diff --git a/Test/Y03arguments.ztst b/Test/Y03arguments.ztst
index 0147c7d..3ada168 100644
--- a/Test/Y03arguments.ztst
+++ b/Test/Y03arguments.ztst
@@ -119,6 +119,11 @@
0:opt_args
>line: {tst -ab 1 }{}
+ tst_arguments '-a:one: :two' ':descr:{compadd -Q - $opt_args[-a]}'
+ comptest $'tst -a 1:x \\2 \t'
+0:opt_args with multiple arguments and quoting of colons and backslashes
+>line: {tst -a 1:x \2 1\:x:\\2 }{}
+
tst_arguments '-a' '*::rest:{compadd - -b}'
comptest $'tst arg -\t'
0:rest arguments
@@ -150,6 +155,94 @@
>NO:{abyyy}
>NO:{abzzz}
+ tst_arguments -x :word
+ comptest $'tst -- -\t'
+0:option after --
+>line: {tst -- -x }{}
+
+ tst_arguments -S -x ':word:()'
+ comptest $'tst -- -\t'
+0:disallowed option after --
+>line: {tst -- -}{}
+
+ tst_arguments -S -x ':word:()'
+ comptest $'tst - --\eB\C-b\t'
+0:allowed option before --
+>line: {tst -x }{ --}
+
+ tst_arguments -x :word
+ comptest $'tst word -\t'
+0:option after a word
+>line: {tst word -x }{}
+
+ tst_arguments -A '-*' -x :word
+ comptest $'tst word -\t'
+0:option after word that doesn't match -A pattern
+>line: {tst word -}{}
+>MESSAGE:{no more arguments}
+
+ tst_arguments -A '-*' -x ':word:(-word)'
+ comptest $'tst word\eB\C-b-\t'
+0:option before a word that doesn't match -A pattern
+>line: {tst -}{ word}
+>DESCRIPTION:{word}
+>NO:{-word}
+>DESCRIPTION:{option}
+>NO:{-x}
+
+ tst_arguments -A '-*' -h -V -a '*: :(-x more)'
+ comptest $'tst -a -x m\t'
+0:continue completion after rest argument that looks like an option
+>line: {tst -a -x more }{}
+
+ tst_arguments -A '-*' - help -h -V - other -a '*: :(-x more)'
+ comptest $'tst -a -x m\t'
+0:continue completion after rest argument that looks like an option (with sets)
+>line: {tst -a -x more }{}
+
+ tst_arguments '(-v)-a' '(set1--m -a)-b' - '(set1)' -m -n - set2 -v -w
+ comptest $'tst -a -\t' $'\C-w\C-w-'{b,m,v}$' -\t'
+0:exclusion lists
+>line: {tst -a -}{}
+>DESCRIPTION:{option}
+>NO:{-b}
+>NO:{-m}
+>NO:{-n}
+>NO:{-w}
+>line: {tst -b -}{}
+>DESCRIPTION:{option}
+>NO:{-n}
+>NO:{-v}
+>NO:{-w}
+>line: {tst -m -}{}
+>DESCRIPTION:{option}
+>NO:{-a}
+>NO:{-b}
+>NO:{-v}
+>NO:{-w}
+>line: {tst -v -}{}
+>DESCRIPTION:{option}
+>NO:{-a}
+>NO:{-b}
+>NO:{-m}
+>NO:{-n}
+>NO:{-w}
+
+ tst_arguments '(-)-h' -a -b -c
+ comptest $'tst -h -\t'
+0:exclude all other options
+>line: {tst -h -}{}
+>MESSAGE:{no arguments}
+
+# this would ideally not offer -b as it is already on the command-line
+ tst_arguments -a '(-a)-b'
+ comptest $'tst - -b\C-b\C-b\C-b\t'
+0:exclusion only applies to later words
+>line: {tst -}{ -b}
+>DESCRIPTION:{option}
+>NO:{-a}
+>NO:{-b}
+
%clean
zmodload -ui zsh/zpty
Messages sorted by:
Reverse Date,
Date,
Thread,
Author