Commit 55e234f5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent aeda2889
...@@ -20,3 +20,50 @@ ...@@ -20,3 +20,50 @@
package main package main
//go:generate ./testdata/zblk_test_gen.py //go:generate ./testdata/zblk_test_gen.py
import (
"context"
"testing"
"lab.nexedi.com/kirr/go123/exc"
"lab.nexedi.com/kirr/neo/go/transaction"
"lab.nexedi.com/kirr/neo/go/zodb"
_ "lab.nexedi.com/kirr/neo/go/zodb/wks"
)
func TestZBlk(t *testing.T) {
X := exc.Raiseif
ctx := context.Background()
stor, err := zodb.OpenStorage(ctx, "testdata/zblk.fs", &zodb.OpenOptions{ReadOnly: true}); X(err)
db := zodb.NewDB(stor)
txn, ctx := transaction.New(ctx)
defer txn.Abort()
conn, err := db.Open(ctx); X(err)
// XXX close db/stor
xz0, err := conn.Get(ctx, z0_oid); X(err)
xz1, err := conn.Get(ctx, z1_oid); X(err)
xzf, err := conn.Get(ctx, zf_oid); X(err)
z0, ok := xz0.(*ZBlk0)
if !ok {
t.Fatalf("z0: want ZBlk0; got %T", xz0)
}
z1, ok := xz1.(*ZBlk1)
if !ok {
t.Fatalf("z1: want ZBlk1; got %T", xz1)
}
zf, ok := xzf.(*ZBigFile)
if !ok {
t.Fatalf("zf: want ZBigFile; got %T", xzf)
}
// XXX
_, _, _ = z0, z1, zf
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment