Skip to content

Commit

Permalink
CI test
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Dec 30, 2020
1 parent 0ebdaa1 commit f7f8ab2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
19 changes: 7 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,15 @@ jobs:
GOOS: windows
GOARCH: amd64
command: go build -o windows-amd64/pod-babashka-sqlite3.exe main.go
# - run:
# name: Install bb for test
# command: |
# mkdir bb
# bash <(curl -sL https://raw.githubusercontent.com/borkdude/babashka/master/install) \
# --dir bb --download-dir bb
# - run:
# name: Run test
# command: cp linux-amd64/pod-babashka-fswatcher . && PATH=$PATH:bb script/test
- run:
name: Test fiddle
name: Install bb for test
command: |
go run fiddle.go
go build -o fiddle fiddle.go
mkdir bb
bash <(curl -sL https://raw.githubusercontent.com/borkdude/babashka/master/install) \
--dir bb --download-dir bb
- run:
name: Run test
command: cp linux-amd64/pod-babashka-sqlite3 . && PATH=$PATH:bb script/test
- save_cache:
key: pod-babashka-sqlite3-{{ checksum "go.sum" }}-{{ checksum ".circleci/config.yml" }}
paths:
Expand Down
3 changes: 3 additions & 0 deletions script/test
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
14 changes: 11 additions & 3 deletions test/script.clj
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)))

0 comments on commit f7f8ab2

Please sign in to comment.