From: Sebastian Gniazdowski <psprint3@fastmail.com>
To: zsh-workers@zsh.org
Subject: Re: V11db_gdbm.ztst fails on Cygwin
Date: Thu, 02 Mar 2017 07:16:59 -0800 [thread overview]
Message-ID: <1488467819.98008.898159816.3346CCE4@webmail.messagingengine.com> (raw)
In-Reply-To: <22600020-4905-4E9B-86DE-663907DBB39C@kba.biglobe.ne.jp>
[-- Attachment #1: Type: text/plain, Size: 576 bytes --]
On Thu, Mar 2, 2017, at 02:52 AM, Jun T. wrote:
> V11db_gdbm.ztst fails on Cygwin as:
>
> ./V11db_gdbm.ztst: starting.
> --- /tmp/zsh.ztst.2148/ztst.out 2017-03-02 19:26:45.040189100 +0900
> +++ /tmp/zsh.ztst.2148/ztst.tout 2017-03-02 19:26:45.055788600
> +0900
> @@ -1,4 +1,4 @@
> -c
> -d
> a
> b
> +c
> +d
Patch equips scan tests with sorting via intermediate array, and adds
one new test that does direct (okv).
Also added test of store in forked Zsh. Gdbm supports multiple access if
users take care of locking.
--
Sebastian Gniazdowski
psprint3@fastmail.com
[-- Attachment #2: v11db_gdbm_sorted_scan.diff --]
[-- Type: text/plain, Size: 3061 bytes --]
diff --git a/Test/V11db_gdbm.ztst b/Test/V11db_gdbm.ztst
index 486ad48..3531cd1 100644
--- a/Test/V11db_gdbm.ztst
+++ b/Test/V11db_gdbm.ztst
@@ -80,59 +80,60 @@
>testdata
ztie -r -d db/gdbm -f $dbfile dbase
- print -rl -- "${(kv)dbase[@]}"
+ local -a result=( "${(kv)dbase[@]}" )
+ print -rl -- "${(o)result[@]}"
zuntie -u dbase
-0:scan read-only tied hash
->testkey
+0:scan read-only tied hash, directly assign local -a
>testdata
->testkey3
>testdataxtestdata
+>testkey
+>testkey3
ztie -d db/gdbm -f $dbfile dbase
- local -a arr
- arr=( "${(kv)dbase[@]}" )
- print -rl -- "${arr[@]}"
+ dbase=( a a )
+ print -rl -- "${(kv)dbase[@]}"
zuntie dbase
-0:different scan, also read-write mode
->testkey
->testdata
->testkey3
->testdataxtestdata
+0:Use scan directly, read-write mode
+>a
+>a
ztie -d db/gdbm -f $dbfile dbase
dbase=( a b c d )
zuntie dbase
ztie -d db/gdbm -f $dbfile dbase
- print -rl -- "${(kv)dbase[@]}"
+ result=( "${(kv)dbase[@]}" )
+ print -rl -- "${(o)result[@]}"
zuntie dbase
0:replace hash / database, scan
->c
->d
>a
>b
+>c
+>d
ztie -d db/gdbm -f $dbfile dbase
local -a arr
arr=( "${dbase[@]}" )
- print -rl -- "${arr[@]}"
+ print -rl -- "${(o)arr[@]}"
zuntie dbase
0:scan with no (kv)
->d
>b
+>d
ztie -d db/gdbm -f $dbfile dbase
- print -rl -- "${(k)dbase[@]}"
+ result=( "${(k)dbase[@]}" )
+ print -rl -- "${(o)result[@]}"
zuntie dbase
0:scan with keys only (k)
->c
>a
+>c
ztie -d db/gdbm -f $dbfile dbase
- print -rl -- "${(v)dbase[@]}"
+ result=( "${(v)dbase[@]}" )
+ print -rl -- "${(o)result[@]}"
zuntie dbase
0:scan with keys only explicit (v)
->d
>b
+>d
rm -f $dbfile
ztie -r -d db/gdbm -f $dbfile dbase 2>/dev/null
@@ -144,18 +145,21 @@
zuntie dbase
ztie -r -d db/gdbm -f $dbfile dbase
echo $dbase[a]
- print -rl -- "${(kv)dbase[@]}"
+ result=( "${(kv)dbase[@]}" )
+ print -rl -- "${(o)result[@]}"
zuntie -u dbase
ztie -d db/gdbm -f $dbfile dbase
dbase+=( c d )
echo $dbase[a]
echo $dbase[c]
- print -rl -- "${(kv)dbase[@]}"
+ result=( "${(kv)dbase[@]}" )
+ print -rl -- "${(o)result[@]}"
zuntie dbase
ztie -r -d db/gdbm -f $dbfile dbase
echo $dbase[a]
echo $dbase[c]
- print -rl -- "${(kv)dbase[@]}"
+ result=( "${(kv)dbase[@]}" )
+ print -rl -- "${(o)result[@]}"
zuntie -u dbase
0:Append with +=( ), also with existing data, also (kv) scan
>b
@@ -164,16 +168,16 @@
>b
>b
>d
->c
->d
>a
>b
->b
->d
>c
>d
+>b
+>d
>a
>b
+>c
+>d
ztie -d db/gdbm -f $dbfile dbase
echo ${(t)dbase}
@@ -291,6 +295,13 @@
>æ¼¢å
ztie -d db/gdbm -f $dbfile dbase
+ noglob print -rl ${(okv)dbase[@]}
+ zuntie dbase
+0:Sorted hash scanning and metafication
+>æ¼¢å
+>æ¼¢å
+
+ ztie -d db/gdbm -f $dbfile dbase
zgdbmpath dbase
[[ $REPLY = */Test/db.gdbm ]] && echo correct
zuntie dbase
@@ -302,6 +313,13 @@
>correct
>correct
+ ztie -d db/gdbm -f $dbfile dbase
+ fun() { while read line; do echo $line; done }
+ eval "dbase[testkey]=value1" | fun
+ echo $dbase[testkey]
+0:Test store in forked Zsh
+>value1
+
%clean
rm -f ${dbfile}*
next prev parent reply other threads:[~2017-03-02 15:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-02 10:52 Jun T.
2017-03-02 11:47 ` Sebastian Gniazdowski
2017-03-02 11:54 ` Peter Stephenson
2017-03-02 11:54 ` Daniel Shahaf
2017-03-02 12:14 ` Sebastian Gniazdowski
2017-03-02 15:16 ` Sebastian Gniazdowski [this message]
2017-03-02 23:56 ` Jun T.
2017-03-03 11:06 ` 淳一 滝本
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=1488467819.98008.898159816.3346CCE4@webmail.messagingengine.com \
--to=psprint3@fastmail.com \
--cc=zsh-workers@zsh.org \
/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).