about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-07-17 10:35:58 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-07-17 10:35:58 +0000
commitcd96c63fe722566769a4de84affae1a6c89cc3c7 (patch)
tree20af2e15c2709f2dfe7d2907655cf6b078dc897e
parent5c412f89052d9ed37ba34078931e2f55c72da4b1 (diff)
downloadzsh-cd96c63fe722566769a4de84affae1a6c89cc3c7.tar.gz
zsh-cd96c63fe722566769a4de84affae1a6c89cc3c7.tar.xz
zsh-cd96c63fe722566769a4de84affae1a6c89cc3c7.zip
* 12274: Test/53completion.ztst, Test/55arguments.ztst,
Test/.distfiles: separates _arguments tests.
-rw-r--r--ChangeLog5
-rw-r--r--Test/.distfiles2
-rw-r--r--Test/53completion.ztst97
-rw-r--r--Test/55arguments.ztst144
4 files changed, 150 insertions, 98 deletions
diff --git a/ChangeLog b/ChangeLog
index 10adfe09b..90c6b8f91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-07-08  Tanaka Akira  <akr@zsh.org>
+
+	* 12274: Test/53completion.ztst, Test/55arguments.ztst,
+	Test/.distfiles: separates _arguments tests.
+
 2000-07-17  Peter Stephenson  <pws@cambridgesiliconradio.com>
 
 	* Config/version.mk: 3.1.9-dev-3.
diff --git a/Test/.distfiles b/Test/.distfiles
index 40c8080d0..63528d4f7 100644
--- a/Test/.distfiles
+++ b/Test/.distfiles
@@ -6,5 +6,5 @@ DISTFILES_SRC='
     10prompt.ztst 11glob.ztst 12procsubst.ztst 13parameter.ztst
     14array.ztst
     50cd.ztst 51xtrace.ztst 52zregexparse.ztst
-    53completion.ztst 54compmatch.ztst
+    53completion.ztst 54compmatch.ztst 55arguments.ztst
 '
diff --git a/Test/53completion.ztst b/Test/53completion.ztst
index b548a9bf7..44a2d19bb 100644
--- a/Test/53completion.ztst
+++ b/Test/53completion.ztst
@@ -49,100 +49,3 @@
 >DI:{dir2}
 >FI:{file1}
 >FI:{file2}
-
- comptesteval 'compdef _tst tst; _tst () { _arguments ":desc1:(arg1)" }'
- comptest $'tst \t'
-0:_arguments
->line: {tst arg1 }{}
-
- comptest $'tst a\t'
-0:_arguments
->line: {tst arg1 }{}
-
- comptest $'tst ar\t'
-0:_arguments
->line: {tst arg1 }{}
-
- comptest $'tst arg\t'
-0:_arguments
->line: {tst arg1 }{}
-
- comptest $'tst arg1\t'
-0:_arguments
->line: {tst arg1 }{}
-
- comptest $'tst r\t'
-0:_arguments
->line: {tst r}{}
-
- comptest $'tst x\t'
-0:_arguments
->line: {tst x}{}
-
- comptest $'tst a \t'
-0:_arguments
->line: {tst a }{}
->MESSAGE:{no more arguments}
-
- comptest $'tst a b \t'
-0:_arguments
->line: {tst a b }{}
->MESSAGE:{no more arguments}
-
- comptesteval 'compdef _tst tst; _tst () { _arguments ":desc1:(a b)" }'
- comptest $'tst \t'
-0:_arguments
->line: {tst }{}
->DESCRIPTION:{desc1}
->NO:{a}
->NO:{b}
-
- comptesteval 'compdef _tst tst; _tst () { _arguments ":desc1:(arg1)" ":desc2:(arg2)" ":desc3:(arg3)" }'
- comptest $'tst \t'
-0:_arguments
->line: {tst arg1 }{}
-
- comptest $'tst arg1 \t'
-0:_arguments
->line: {tst arg1 arg2 }{}
-
- comptest $'tst arg1 arg2 \t'
-0:_arguments
->line: {tst arg1 arg2 arg3 }{}
-
- comptest $'tst \C-D'
-0:_arguments
->DESCRIPTION:{desc1}
->NO:{arg1}
-
- comptesteval 'compdef _tst tst; _tst () { _arguments "-\+[opt]" }'
- comptest $'tst -\C-D'
-0:_arguments
->DESCRIPTION:{option}
->NO:{-+ -- opt}
-
- comptesteval 'compdef _tst tst; _tst () { _arguments "1:desc1:(arg1)" }'
- comptest $'tst \t'
-0:_arguments
->line: {tst arg1 }{}
-
- comptesteval 'compdef _tst tst; _tst () { _arguments "-x" ":arg:" }'
- comptest $'tst -\t'
-0:_arguments
->line: {tst -}{}
->MESSAGE:{arg}
-
- comptesteval 'compdef _tst tst; _tst () { _arguments "-x:arg:" }'
- comptest $'tst -x\t'
-0:_arguments
->line: {tst -x }{}
-
- comptesteval '
-   compdef _tst tst
-   _tst () { _arguments "-a" "*::rest:_tst2" }
-   _tst2 () { compadd - -b }
- '
- comptest $'tst arg -\t'
-0:_arguments
->line: {tst arg -b }{}
-
diff --git a/Test/55arguments.ztst b/Test/55arguments.ztst
new file mode 100644
index 000000000..0fe23b076
--- /dev/null
+++ b/Test/55arguments.ztst
@@ -0,0 +1,144 @@
+# Tests for _arguments.
+
+%prep
+  . $ZTST_srcdir/comptest
+
+  mkdir comp.tmp
+  cd comp.tmp
+
+  comptestinit -z $ZTST_testdir/../Src/zsh
+  comptesteval 'compdef _tst tst'
+  tst_arguments () { comptesteval "_tst () { _arguments ${${(@qq)*}} }" }
+
+%test
+ tst_arguments ':desc1:(arg1)'
+ comptest $'tst \t\C-wa\t\C-war\t\C-warg\t\C-warg1\t\C-wr\t\C-wx\t \ty \t'
+0:one non-option argument
+>line: {tst arg1 }{}
+>line: {tst arg1 }{}
+>line: {tst arg1 }{}
+>line: {tst arg1 }{}
+>line: {tst arg1 }{}
+>line: {tst r}{}
+>line: {tst x}{}
+>line: {tst x }{}
+>MESSAGE:{no more arguments}
+>line: {tst x y }{}
+>MESSAGE:{no more arguments}
+
+ tst_arguments ':desc1:(a b)'
+ comptest $'tst \t'
+0:a and b
+>line: {tst }{}
+>DESCRIPTION:{desc1}
+>NO:{a}
+>NO:{b}
+
+ tst_arguments ':desc1:(arg1)' ':desc2:(arg2)' ':desc3:(arg3)'
+ comptest $'tst \t\t\t\C-w\C-w\C-w\C-d'
+0:three arguments
+>line: {tst arg1 }{}
+>line: {tst arg1 arg2 }{}
+>line: {tst arg1 arg2 arg3 }{}
+>DESCRIPTION:{desc1}
+>NO:{arg1}
+
+ tst_arguments '1:desc1:(arg1)'
+ comptest $'tst \t\t'
+0:first argument
+>line: {tst arg1 }{}
+>line: {tst arg1 }{}
+>MESSAGE:{no more arguments}
+
+ tst_arguments '-\+[opt]'
+ comptest $'tst -\C-d'
+0:-+
+>DESCRIPTION:{option}
+>NO:{-+ -- opt}
+
+ tst_arguments -+o
+ comptest $'tst -\t\t\t\C-w\C-w+\t\t\t'
+0:option beginning with + and -.
+>line: {tst -o }{}
+>line: {tst -o +o }{}
+>line: {tst -o +o }{}
+>MESSAGE:{no arguments}
+>line: {tst +o }{}
+>line: {tst +o -o }{}
+>line: {tst +o -o }{}
+>MESSAGE:{no arguments}
+
+ tst_arguments '-o:1:(a):2:(b)'
+ comptest $'tst \t\t\t'
+0:two option arguments
+>line: {tst -o }{}
+>line: {tst -o a }{}
+>line: {tst -o a b }{}
+
+ tst_arguments '-x:arg:'
+ comptest $'tst -x\t'
+0:sticky option argument
+>line: {tst -x }{}
+
+ tst_arguments '-x[desc]'
+ comptest $'tst -x\t'
+0:end of option sequence
+>line: {tst -x }{}
+
+ tst_arguments '-x' ':arg:'
+ comptest $'tst -\t'
+0:argument beginning with minus
+>line: {tst -}{}
+>MESSAGE:{arg}
+
+ tst_arguments '-o::optarg:(oa)' ':arg1:(a1)'
+ comptest $'tst -o\t\t'
+0:optional option argument
+>line: {tst -o }{}
+>line: {tst -o }{}
+>DESCRIPTION:{optarg}
+>NO:{oa}
+>DESCRIPTION:{arg1}
+>NO:{a1}
+
+ tst_arguments '-o:*a:a:(a)' ':A:(A)' ':B:(B)'
+ comptest $'tst A -o a \t'
+0:variable length option arguments
+>line: {tst A -o a B }{}
+
+ tst_arguments -s '-a' '-b' ':descr:{compadd - $+opt_args[-a]}'
+ comptest $'tst -ab \t'
+0:opt_args
+>line: {tst -ab 1 }{}
+
+ tst_arguments '-a' '*::rest:{compadd - -b}'
+ comptest $'tst arg -\t'
+0:rest arguments
+>line: {tst arg -b }{}
+
+ tst_arguments '-e:*last:::b:{compadd "${(j:,:)words}"}' ':arg1:(arg1)'
+ comptest $'tst -\t\tla\t\C-hst\t\t\eb\eb\C-b\t\t'
+0:words array in rest arguments
+>line: {tst -e }{}
+>line: {tst -e  }{}
+>line: {tst -e  la }{}
+>line: {tst -e  last }{}
+>line: {tst -e  last arg1 }{}
+>line: {tst -e ,last }{ last arg1}
+>line: {tst -e ,last ,last,,last }{ last arg1}
+
+ tst_arguments -s '-d+:msg1:' '*::msg2:{compadd $CURRENT}' 
+ comptest $'tst add \t\t\t'
+0:opt_args
+>line: {tst add 2 }{}
+>line: {tst add 2 3 }{}
+>line: {tst add 2 3 4 }{}
+
+ tst_arguments -s '-a' '-b' '-c' ':words:compadd - abyyy abzzz' 
+ comptest $'tst ab\t'
+0:options and words (zsh-workers:12257)
+>line: {tst ab}{}
+>DESCRIPTION:{words}
+>NO:{abyyy}
+>NO:{abzzz}
+