summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2019-05-08 16:38:12 -0500
committerdana <dana@dana.is>2019-05-08 16:38:12 -0500
commitffacb17886e8071332c0b1dc8263e7dbe6af268a (patch)
treecaffbe80e5e3b53f1e09df4bb123232f8a17e4cd /Test
parentc1a33575b4c522cea71c57664c852727fe6a633c (diff)
downloadzsh-ffacb17886e8071332c0b1dc8263e7dbe6af268a.tar.gz
zsh-ffacb17886e8071332c0b1dc8263e7dbe6af268a.tar.xz
zsh-ffacb17886e8071332c0b1dc8263e7dbe6af268a.zip
unposted: Add compset tests related to workers/44275
(Provided off-list by Oliver)
Diffstat (limited to 'Test')
-rw-r--r--Test/Y01completion.ztst38
1 files changed, 38 insertions, 0 deletions
diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
index ff266306f..9c2eaaa5f 100644
--- a/Test/Y01completion.ztst
+++ b/Test/Y01completion.ztst
@@ -1,6 +1,16 @@
 # Tests for completion system.
 
 %prep
+  unset -m LC_\*
+  ZSH_TEST_LANG=
+  langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
+         $(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
+  for LANG in $langs; do
+    if [[ ?? = ? ]]; then
+      ZSH_TEST_LANG=$LANG
+      break;
+    fi
+  done
   if [[ $OSTYPE = cygwin ]]; then
     ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
   elif ( zmodload zsh/zpty 2>/dev/null ); then
@@ -107,6 +117,34 @@ F:regression test workers/31611
 >line: {cd "A(B)/C/}{}
 >line: {cd ../C/}{}
 
+  comptesteval '_tst() { compset -p 1; _message "${(qq)IPREFIX} ${(qq)PREFIX}" }'
+  comptest $'tst .\t'
+0:remove exact number of characters from a prefix
+>line: {tst .}{}
+>MESSAGE:{'.' ''}
+
+  comptesteval '_tst() { compset -s 3; _message "${(qq)SUFFIX} ${(qq)ISUFFIX}" }'
+  comptest $'tst 123\eb\t'
+0:remove exact number of characters from a suffix
+>line: {tst }{123}
+>MESSAGE:{'' '123'}
+
+  comptesteval '_tst() { compset -p 2; compset -p 3;compset -s 2;compset -s 3; _message "${(qq)PREFIX} ${(qq)SUFFIX}" }'
+  comptest $'tst 12345678\e4\C-b\t'
+0:try to remove excess characters from prefix and suffix
+>line: {tst 1234}{5678}
+>MESSAGE:{'34' '56'}
+
+  if [[ -z $ZSH_TEST_LANG ]]; then
+    ZTST_skip="no UTF-8 locale for multibyte completion test"
+  else
+    comptesteval '_tst() { compset -p 1; _message "${(qq)IPREFIX} ${(qq)PREFIX}" }'
+    comptest $'tst ???100\t'
+  fi
+0:remove multibyte character from a prefix
+>line: {tst ???100}{}
+>MESSAGE:{'???' '100'}
+
   comptesteval "_tst() { compadd -U -s : -S / -I . word; compstate[to_end]= }"
   comptest $'tst .\C-b\t'
 0:allow for suffixes when moving cursor to end of match (with ignored suffix)