initial commit
This commit is contained in:
27
test/test.kk
Normal file
27
test/test.kk
Normal file
@@ -0,0 +1,27 @@
|
||||
module test
|
||||
|
||||
import sqlite/sqlite3
|
||||
|
||||
// TODO(zephyr): For now, we're just doing a very basic test to estimate whether
|
||||
// I'm doing Koka FFI correctly. An actual test suite would be excellent.
|
||||
|
||||
fun stmt(db: sqlite3, text: string)
|
||||
println(text)
|
||||
match db.prepare(text.slice)
|
||||
Left(r-prep) -> println(" prepare result: " ++ r-prep.show)
|
||||
Right((stmt, rest)) ->
|
||||
println(" prepare remainder: " ++ rest.show)
|
||||
val r-step = stmt.step
|
||||
println(" step result: " ++ r-step.show)
|
||||
val r-fin = stmt.finalize
|
||||
println(" finalize result: " ++ r-fin.show)
|
||||
|
||||
pub fun main()
|
||||
println("initialize result: " ++ startup-initialized.show)
|
||||
val (db, r-open) = open(Filename("koka-test.sqlite3"))
|
||||
println("open result: " ++ r-open.show)
|
||||
stmt(db, "DROP TABLE IF EXISTS koka; -- reset previous test runs")
|
||||
stmt(db, "CREATE TABLE koka(v TEXT NOT NULL)")
|
||||
stmt(db, "INSERT INTO koka VALUES ('value inserted from koka');")
|
||||
val r-close = db.close
|
||||
println("close result: " ++ r-close.show)
|
||||
Reference in New Issue
Block a user