mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
More type safe. (#216)
This commit is contained in:
@@ -22,7 +22,7 @@ func Test_sqlite_error_OOM(t *testing.T) {
|
||||
defer sqlite.close()
|
||||
|
||||
defer func() { _ = recover() }()
|
||||
sqlite.error(uint64(NOMEM), 0)
|
||||
sqlite.error(res_t(NOMEM), 0)
|
||||
t.Error("want panic")
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ func Test_sqlite_newArena(t *testing.T) {
|
||||
}
|
||||
defer sqlite.close()
|
||||
|
||||
arena := sqlite.newArena(16)
|
||||
arena := sqlite.newArena()
|
||||
defer arena.free()
|
||||
|
||||
const title = "Lorem ipsum"
|
||||
@@ -73,7 +73,7 @@ func Test_sqlite_newArena(t *testing.T) {
|
||||
if ptr == 0 {
|
||||
t.Fatalf("got nullptr")
|
||||
}
|
||||
if got := util.ReadString(sqlite.mod, ptr, math.MaxUint32); got != title {
|
||||
if got := util.ReadString(sqlite.mod, ptr, math.MaxInt); got != title {
|
||||
t.Errorf("got %q, want %q", got, title)
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ func Test_sqlite_newArena(t *testing.T) {
|
||||
if ptr == 0 {
|
||||
t.Fatalf("got nullptr")
|
||||
}
|
||||
if got := util.ReadString(sqlite.mod, ptr, math.MaxUint32); got != body {
|
||||
if got := util.ReadString(sqlite.mod, ptr, math.MaxInt); got != body {
|
||||
t.Errorf("got %q, want %q", got, body)
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ func Test_sqlite_newArena(t *testing.T) {
|
||||
if ptr == 0 {
|
||||
t.Fatalf("got nullptr")
|
||||
}
|
||||
if got := util.View(sqlite.mod, ptr, uint64(len(title))); string(got) != title {
|
||||
if got := util.View(sqlite.mod, ptr, int64(len(title))); string(got) != title {
|
||||
t.Errorf("got %q, want %q", got, title)
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ func Test_sqlite_newBytes(t *testing.T) {
|
||||
}
|
||||
|
||||
want := buf
|
||||
if got := util.View(sqlite.mod, ptr, uint64(len(want))); !bytes.Equal(got, want) {
|
||||
if got := util.View(sqlite.mod, ptr, int64(len(want))); !bytes.Equal(got, want) {
|
||||
t.Errorf("got %q, want %q", got, want)
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ func Test_sqlite_newString(t *testing.T) {
|
||||
}
|
||||
|
||||
want := str + "\000"
|
||||
if got := util.View(sqlite.mod, ptr, uint64(len(want))); string(got) != want {
|
||||
if got := util.View(sqlite.mod, ptr, int64(len(want))); string(got) != want {
|
||||
t.Errorf("got %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,7 @@ func Test_sqlite_getString(t *testing.T) {
|
||||
}
|
||||
|
||||
want := "sqlite3"
|
||||
if got := util.ReadString(sqlite.mod, ptr, math.MaxUint32); got != want {
|
||||
if got := util.ReadString(sqlite.mod, ptr, math.MaxInt); got != want {
|
||||
t.Errorf("got %q, want %q", got, want)
|
||||
}
|
||||
if got := util.ReadString(sqlite.mod, ptr, 0); got != "" {
|
||||
@@ -192,13 +192,13 @@ func Test_sqlite_getString(t *testing.T) {
|
||||
|
||||
func() {
|
||||
defer func() { _ = recover() }()
|
||||
util.ReadString(sqlite.mod, ptr, uint32(len(want)/2))
|
||||
util.ReadString(sqlite.mod, ptr, int64(len(want))/2)
|
||||
t.Error("want panic")
|
||||
}()
|
||||
|
||||
func() {
|
||||
defer func() { _ = recover() }()
|
||||
util.ReadString(sqlite.mod, 0, math.MaxUint32)
|
||||
util.ReadString(sqlite.mod, 0, math.MaxInt)
|
||||
t.Error("want panic")
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user