-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
21 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
go build -o pod-babashka-sqlite3 main.go && test/script.clj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
#!/usr/bin/env bb | ||
|
||
(ns script | ||
(:require [babashka.pods :as pods])) | ||
(:require [babashka.pods :as pods] | ||
[clojure.test :as t :refer [deftest is]])) | ||
|
||
(prn (pods/load-pod "./main")) | ||
(prn (pods/load-pod "./pod-babashka-sqlite3")) | ||
|
||
(require '[pod.babashka.sqlite3 :as sqlite]) | ||
|
||
(prn (sqlite/execute! "/tmp/foo.db" ["create table if not exists foo (col1 TEXT, col2 TEXT)"])) | ||
(prn (sqlite/execute! "/tmp/foo.db" ["delete from foo"])) | ||
(prn (sqlite/execute! "/tmp/foo.db" ["insert into foo values (?,?)" "foo" "bar"])) | ||
(prn (sqlite/query! "/tmp/foo.db" ["select * from foo"])) | ||
(def results (sqlite/query! "/tmp/foo.db" ["select * from foo"])) | ||
(prn results) | ||
|
||
(deftest results-test | ||
(is (= [{:col1 "foo", :col2 "bar"}] results))) | ||
|
||
(let [{:keys [:fail :error]} (t/run-tests)] | ||
(System/exit (+ fail error))) |