Skip to content

Commit f694bb7

Browse files
committed
remove dependency of assert
1 parent 0147a48 commit f694bb7

File tree

1 file changed

+36
-14
lines changed

1 file changed

+36
-14
lines changed

vtable_test.go

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import (
1010
"fmt"
1111
"os"
1212
"testing"
13-
14-
"github.com/stretchr/testify/assert"
1513
)
1614

1715
type testModule struct {
@@ -29,13 +27,27 @@ type testVTabCursor struct {
2927
}
3028

3129
func (m testModule) Create(c *SQLiteConn, args []string) (VTab, error) {
32-
assert.True(m.t, len(args) == 6, "six arguments expected")
33-
assert.Equal(m.t, "test", args[0], "module name")
34-
assert.Equal(m.t, "main", args[1], "db name")
35-
assert.Equal(m.t, "vtab", args[2], "table name")
36-
assert.Equal(m.t, "'1'", args[3], "first arg")
37-
assert.Equal(m.t, "2", args[4], "second arg")
38-
assert.Equal(m.t, "three", args[5], "third arg")
30+
if len(args) != 6 {
31+
m.t.Fatal("six arguments expected")
32+
}
33+
if args[0] != "test" {
34+
m.t.Fatal("module name")
35+
}
36+
if args[1] != "main" {
37+
m.t.Fatal("db name")
38+
}
39+
if args[2] != "vtab" {
40+
m.t.Fatal("table name")
41+
}
42+
if args[3] != "'1'" {
43+
m.t.Fatal("first arg")
44+
}
45+
if args[4] != "2" {
46+
m.t.Fatal("second arg")
47+
}
48+
if args[5] != "three" {
49+
m.t.Fatal("third argsecond arg")
50+
}
3951
err := c.DeclareVTab("CREATE TABLE x(test TEXT)")
4052
if err != nil {
4153
return nil, err
@@ -116,17 +128,27 @@ func TestCreateModule(t *testing.T) {
116128
},
117129
})
118130
db, err := sql.Open("sqlite3_TestCreateModule", tempFilename)
119-
assert.Nil(t, err, "could not open db")
131+
if err != nil {
132+
t.Fatalf("could not open db: %v", err)
133+
}
120134
_, err = db.Exec("CREATE VIRTUAL TABLE vtab USING test('1', 2, three)")
121-
assert.Nil(t, err, "could not create vtable")
135+
if err != nil {
136+
t.Fatal("could not create vtable: %v", err)
137+
}
122138

123139
var i, value int
124140
rows, err := db.Query("SELECT rowid, * FROM vtab WHERE test = '3'")
125-
assert.Nil(t, err, "couldn't select from virtual table")
141+
if err != nil {
142+
t.Fatalf("couldn't select from virtual table: %v", err)
143+
}
126144
for rows.Next() {
127145
rows.Scan(&i, &value)
128-
assert.Equal(t, intarray[i], value)
146+
if intarray[i] != value {
147+
t.Fatalf("want %v but %v", intarray[i], value)
148+
}
129149
}
130150
_, err = db.Exec("DROP TABLE vtab")
131-
assert.Nil(t, err, "couldn't drop virtual table")
151+
if err != nil {
152+
t.Fatalf("couldn't drop virtual table: %v", err)
153+
}
132154
}

0 commit comments

Comments
 (0)