Commit f99eac24 authored by gwenn's avatar gwenn

Add Interrupt test.

parent 19b7087a
......@@ -8,22 +8,26 @@ import (
"time"
)
/*
func TestInterrupt(t *testing.T) {
db := open(t)
defer db.Close()
db.CreateScalarFunction("interrupt", 0, nil, func(ctx *Context, nArg int) {
//db.Interrupt()
db.Interrupt()
ctx.ResultText("ok")
}, nil)
var err error
var result string
err = db.OneValue("select interrupt()", &result)
if err == nil || err != ErrInterrupt {
}, nil)
s, err := db.Prepare("SELECT interrupt() FROM (SELECT 1 UNION SELECT 2 UNION SELECT 3)")
checkNoError(t, err, "couldn't prepare stmt: %#v")
defer s.Finalize()
err = s.Select(func(s *Stmt) (err error) {
return
})
if err == nil {
t.Fatalf("Expected interrupt but got %v", err)
}
if se, ok := err.(*StmtError); !ok || se.Code() != ErrInterrupt {
t.Errorf("Expected interrupt but got %#v", err)
}
}
*/
func openTwoConnSameDb(t *testing.T) (*os.File, *Conn, *Conn) {
f, err := ioutil.TempFile("", "gosqlite-test")
......
......@@ -70,9 +70,9 @@ func TestTransaction(t *testing.T) {
db := open(t)
defer db.Close()
checkNoError(t, db.Begin(), "Error while beginning transaction: %s")
/*if err := db.Begin(); err == nil {
if err := db.Begin(); err == nil {
t.Fatalf("Error expected (transaction cannot be nested)")
}*/
}
checkNoError(t, db.Commit(), "Error while commiting transaction: %s")
}
......
......@@ -7,7 +7,7 @@ import (
)
func init() {
ConfigLog(log, "LOG")
//ConfigLog(log, "LOG")
}
func trace(d interface{}, sql string) {
......@@ -75,5 +75,5 @@ func TestTrace(t *testing.T) {
}
func TestLog(t *testing.T) {
//Log(0, "One message")
Log(0, "One message")
}
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