Generalize test code for <?run to work in either environment.

Signed-off-by: Richard Newman <rnewman@twinql.com>
This commit is contained in:
Richard Newman 2016-07-15 12:36:46 -07:00
parent d695554123
commit e76895ac00

View file

@ -17,11 +17,12 @@
[[datomish.jdbc-sqlite] [[datomish.jdbc-sqlite]
[datomish.pair-chan :refer [go-pair <?]] [datomish.pair-chan :refer [go-pair <?]]
[datomish.util :refer [while-let]] [datomish.util :refer [while-let]]
[clojure.core.async]]) [clojure.core.async :refer [<!]]])
#?@(:cljs #?@(:cljs
[[datomish.promise-sqlite] [[datomish.promise-sqlite]
[datomish.pair-chan] [datomish.pair-chan]
[datomish.util]]))) [datomish.util]
[cljs.core.async :refer [<!]]])))
#?(:clj #?(:clj
(defn pair-channel->lazy-seq (defn pair-channel->lazy-seq
@ -57,13 +58,13 @@
"/tmp/foo.sqlite" "/tmp/foo.sqlite"
'[:find ?page :in $ :where [?page :page/starred true ?t]])) '[:find ?page :in $ :where [?page :page/starred true ?t]]))
#_(defn test-cljs [] #_(defn test-run []
(datomish.pair-chan/go-pair (datomish.pair-chan/go-pair
(let [d (datomish.pair-chan/<? (s/<sqlite-connection "/tmp/foo.sqlite"))] (let [d (datomish.pair-chan/<? (s/<sqlite-connection "/tmp/foo.sqlite"))]
(cljs.core.async/<! (ss/<ensure-current-version d)) (<! (ss/<ensure-current-version d))
(let [chan (exec/<?run d (let [chan (exec/<?run d
'[:find ?page :in $ :where [?page :page/starred true ?t]])] '[:find ?page :in $ :where [?page :page/starred true ?t]])]
(println (datomish.pair-chan/<? chan)) (println (datomish.pair-chan/<? chan))
(println (datomish.pair-chan/<? chan)) (println (datomish.pair-chan/<? chan))
(println (datomish.pair-chan/<? chan)))))) (println (datomish.pair-chan/<? chan))
(s/close d)))))