mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-11 21:49:13 +00:00
Documentation, tests, tweaks.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package sqlite3
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -9,7 +8,7 @@ import (
|
||||
|
||||
func Test_assertErr(t *testing.T) {
|
||||
err := assertErr()
|
||||
if s := err.Error(); !strings.HasPrefix(s, "sqlite3: assertion failed") || !strings.HasSuffix(s, "error_test.go:11)") {
|
||||
if s := err.Error(); !strings.HasPrefix(s, "sqlite3: assertion failed") || !strings.HasSuffix(s, "error_test.go:10)") {
|
||||
t.Errorf("got %q", s)
|
||||
}
|
||||
}
|
||||
@@ -120,10 +119,8 @@ func Test_ErrorCode_Error(t *testing.T) {
|
||||
// Test all error codes.
|
||||
for i := 0; i == int(ErrorCode(i)); i++ {
|
||||
want := "sqlite3: "
|
||||
r, _ := db.api.errstr.Call(context.TODO(), uint64(i))
|
||||
if r != nil {
|
||||
want += db.mem.readString(uint32(r[0]), _MAX_STRING)
|
||||
}
|
||||
r := db.call(db.api.errstr, uint64(i))
|
||||
want += db.mem.readString(uint32(r[0]), _MAX_STRING)
|
||||
|
||||
got := ErrorCode(i).Error()
|
||||
if got != want {
|
||||
@@ -144,10 +141,8 @@ func Test_ExtendedErrorCode_Error(t *testing.T) {
|
||||
// Test all extended error codes.
|
||||
for i := 0; i == int(ExtendedErrorCode(i)); i++ {
|
||||
want := "sqlite3: "
|
||||
r, _ := db.api.errstr.Call(context.TODO(), uint64(i))
|
||||
if r != nil {
|
||||
want += db.mem.readString(uint32(r[0]), _MAX_STRING)
|
||||
}
|
||||
r := db.call(db.api.errstr, uint64(i))
|
||||
want += db.mem.readString(uint32(r[0]), _MAX_STRING)
|
||||
|
||||
got := ExtendedErrorCode(i).Error()
|
||||
if got != want {
|
||||
|
||||
Reference in New Issue
Block a user