From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh <zsh-workers@sunsite.dk>
Subject: PATCH: multibyte parameter tests
Date: Mon, 26 Jun 2006 22:59:57 +0100 [thread overview]
Message-ID: <20060626225957.738034f6.p.w.stephenson@ntlworld.com> (raw)
This adds a few tests for parameter subscripting of multibyte
characters.
(r) subscripting with multibyte characters is broken: all those endless
bits of getarg() with pattry() in need their indexes fixing up. Yuk.
Index: Test/D07multibyte.ztst
===================================================================
RCS file: Test/D07multibyte.ztst
diff -N Test/D07multibyte.ztst
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Test/D07multibyte.ztst 26 Jun 2006 21:55:39 -0000
@@ -0,0 +1,87 @@
+%prep
+
+# Find a UTF-8 locale.
+ setopt multibyte
+ mb_ok=
+ langs=(en_US.UTF-8 en_GB.UTF-8 en.UTF-8
+ $(locale -a 2>/dev/null | sed -e 's/utf8/UTF-8/' | grep UTF-8))
+ for LANG in $langs; do
+ if [[ é = ? ]]; then
+ mb_ok=1
+ break;
+ fi
+ done
+ if [[ -z $mb_ok ]]; then
+ ZTST_unimplemented="no UTF-8 locale or multibyte mode is not implemnted"
+ else
+ print Testing multibyte with locale $LANG >&8
+ fi
+
+%test
+
+ a=ténébreux
+ for i in {1..9}; do
+ print ${a[i]}
+ for j in {$i..9}; do
+ print $i $j ${a[i,j]} ${a[-j,-i]}
+ done
+ done
+0:Basic indexing with multibyte characters
+>t
+>1 1 t x
+>1 2 té ux
+>1 3 tén eux
+>1 4 téné reux
+>1 5 ténéb breux
+>1 6 ténébr ébreux
+>1 7 ténébre nébreux
+>1 8 ténébreu énébreux
+>1 9 ténébreux ténébreux
+>é
+>2 2 é u
+>2 3 én eu
+>2 4 éné reu
+>2 5 énéb breu
+>2 6 énébr ébreu
+>2 7 énébre nébreu
+>2 8 énébreu énébreu
+>2 9 énébreux ténébreu
+>n
+>3 3 n e
+>3 4 né re
+>3 5 néb bre
+>3 6 nébr ébre
+>3 7 nébre nébre
+>3 8 nébreu énébre
+>3 9 nébreux ténébre
+>é
+>4 4 é r
+>4 5 éb br
+>4 6 ébr ébr
+>4 7 ébre nébr
+>4 8 ébreu énébr
+>4 9 ébreux ténébr
+>b
+>5 5 b b
+>5 6 br éb
+>5 7 bre néb
+>5 8 breu énéb
+>5 9 breux ténéb
+>r
+>6 6 r é
+>6 7 re né
+>6 8 reu éné
+>6 9 reux téné
+>e
+>7 7 e n
+>7 8 eu én
+>7 9 eux tén
+>u
+>8 8 u é
+>8 9 ux té
+>x
+>9 9 x t
+
+ print ${a[(i)é]} ${a[(I)é]} ${a[${a[(i)é]},${a[(I)é]}]}
+0:Reverse indexing with multibyte characters
+>2 4 éné
reply other threads:[~2006-06-26 22:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060626225957.738034f6.p.w.stephenson@ntlworld.com \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).