-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
alloc_test.go
30 lines (24 loc) · 843 Bytes
/
alloc_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package notmuch
// Copyright © 2015 The go.notmuch Authors. Authors can be found in the AUTHORS file.
// Licensed under the GPLv3 or later.
// See COPYING at the root of the repository for details.
// This file contains tests that exercise the resource creation/reclamation model.
import (
"testing"
)
// Basic test of the case where the user explicitly closes a parent object
// before the child object. This is inevitable if Close is used at all; the
// GC will close things child-first.
func TestOutOfOrderClose(t *testing.T) {
db, err := Open(dbPath, DBReadOnly)
if err != nil {
t.Fatalf("Open(%q): unexpected error: %s", dbPath, err)
}
query := db.NewQuery("subject:\"Introducing myself\"")
threads, err := query.Threads()
if err != nil {
t.Fatalf("error getting the threads: %s", err)
}
db.Close()
threads.Close()
}