Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: V11db_gdbm.ztst fails on Cygwin
- X-seq: zsh-workers 40706
- From: Sebastian Gniazdowski <psprint3@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: V11db_gdbm.ztst fails on Cygwin
- Date: Thu, 02 Mar 2017 07:16:59 -0800
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=VFVM383NRyeU8e/7iHpHt1cJUL 0=; b=o6TuxR9CT54hb2g01KhisIeV3kUjkVEyLBFHZpiXmPegJJ2obEuFbc8LHt cDrtywCjXXNzVNrZbxJ9CFc1reroRgA+Kk48DdfGF0LYIn3EXBoVsyrDYo051iwW u+KjjSj3oKBJmhbSScLJErfjF5v9Ll7kOT6wMaH1rkgm7bAjA=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=smtpout; bh=VF VM383NRyeU8e/7iHpHt1cJUL0=; b=L3AK0A+DnqFlSptt94M5XOy6ih+axBeNWI DQCBDtvJttloJLH0VVudVHg0gT9rqpVo2EiO4ulNZg6UBf6h1wTMGX9NhZcYOFm/ 1FX1tMZKE69WDeHFGI1MUR6W06L4ZdODyCG3x3ZcRusnBayhIIlVmib4aHu0l0Tq 0BiRqgMDw=
- In-reply-to: <22600020-4905-4E9B-86DE-663907DBB39C@kba.biglobe.ne.jp>
- 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
- References: <22600020-4905-4E9B-86DE-663907DBB39C@kba.biglobe.ne.jp>
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@xxxxxxxxxxxx
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}*
Messages sorted by:
Reverse Date,
Date,
Thread,
Author