Migrate to sci.lang.Var (#1285)
This commit is contained in:
parent
5ec6fca29a
commit
8e3f22db7a
6 changed files with 11 additions and 10 deletions
2
sci
2
sci
|
|
@ -1 +1 @@
|
||||||
Subproject commit 05727e9ddccc9d641d1d4ba05cd444904ec66514
|
Subproject commit 15ef9bd19df0446c7fc7cc245d0d36c2503dc102
|
||||||
|
|
@ -9,7 +9,8 @@
|
||||||
[sci.core :as sci]
|
[sci.core :as sci]
|
||||||
[sci.impl.namespaces :refer [copy-core-var core-var macrofy]]
|
[sci.impl.namespaces :refer [copy-core-var core-var macrofy]]
|
||||||
[sci.impl.parser :as parser]
|
[sci.impl.parser :as parser]
|
||||||
[sci.impl.vars :as vars :refer [clojure-core-ns]]))
|
[sci.impl.utils :refer [clojure-core-ns]]
|
||||||
|
[sci.impl.vars :as vars]))
|
||||||
|
|
||||||
(defn locking* [form bindings v f & args]
|
(defn locking* [form bindings v f & args]
|
||||||
(apply @#'locking/locking form bindings v f args))
|
(apply @#'locking/locking form bindings v f args))
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
[babashka.impl.common :refer [debug]]
|
[babashka.impl.common :refer [debug]]
|
||||||
[sci.core :as sci]
|
[sci.core :as sci]
|
||||||
[sci.impl.parser :as p]
|
[sci.impl.parser :as p]
|
||||||
[sci.impl.vars :as vars])
|
[sci.impl.utils :as utils])
|
||||||
(:import
|
(:import
|
||||||
[clojure.lang LineNumberingPushbackReader]
|
[clojure.lang LineNumberingPushbackReader]
|
||||||
[java.io BufferedWriter InputStreamReader OutputStreamWriter]
|
[java.io BufferedWriter InputStreamReader OutputStreamWriter]
|
||||||
|
|
@ -214,7 +214,7 @@
|
||||||
:val (if (instance? Throwable ret)
|
:val (if (instance? Throwable ret)
|
||||||
(Throwable->map ret)
|
(Throwable->map ret)
|
||||||
ret)
|
ret)
|
||||||
:ns (str (vars/current-ns-name))
|
:ns (str (utils/current-ns-name))
|
||||||
:ms ms
|
:ms ms
|
||||||
:form s})
|
:form s})
|
||||||
true)))
|
true)))
|
||||||
|
|
|
||||||
|
|
@ -409,7 +409,7 @@
|
||||||
[x]
|
[x]
|
||||||
(if (symbol? x)
|
(if (symbol? x)
|
||||||
(when-let [v (second (resolve/lookup @ctx x false))]
|
(when-let [v (second (resolve/lookup @ctx x false))]
|
||||||
(when-let [value (if (vars/var? v)
|
(when-let [value (if (instance? sci.lang.Var v)
|
||||||
(get-possibly-unbound-var v)
|
(get-possibly-unbound-var v)
|
||||||
v)]
|
v)]
|
||||||
(and (fn? value)
|
(and (fn? value)
|
||||||
|
|
@ -667,7 +667,7 @@
|
||||||
value of key."
|
value of key."
|
||||||
{:added "1.1"}
|
{:added "1.1"}
|
||||||
[key coll]
|
[key coll]
|
||||||
(swap! ns->fixtures assoc-in [(sci-namespaces/sci-ns-name @vars/current-ns) key] coll))
|
(swap! ns->fixtures assoc-in [(sci-namespaces/sci-ns-name @sci/ns) key] coll))
|
||||||
|
|
||||||
(defmulti use-fixtures
|
(defmulti use-fixtures
|
||||||
"Wrap test runs in a fixture function to perform setup and
|
"Wrap test runs in a fixture function to perform setup and
|
||||||
|
|
@ -779,7 +779,7 @@
|
||||||
Defaults to current namespace if none given. Returns a map
|
Defaults to current namespace if none given. Returns a map
|
||||||
summarizing test results."
|
summarizing test results."
|
||||||
{:added "1.1"}
|
{:added "1.1"}
|
||||||
([ctx] (run-tests ctx @vars/current-ns))
|
([ctx] (run-tests ctx @sci/ns))
|
||||||
([ctx & namespaces]
|
([ctx & namespaces]
|
||||||
(let [summary (assoc (apply merge-with + (map #(test-ns ctx %) namespaces))
|
(let [summary (assoc (apply merge-with + (map #(test-ns ctx %) namespaces))
|
||||||
:type :summary)]
|
:type :summary)]
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@
|
||||||
stacktrace (dedupe
|
stacktrace (dedupe
|
||||||
(concat (sequence (comp (map StackTraceElement->vec)
|
(concat (sequence (comp (map StackTraceElement->vec)
|
||||||
(take-while #(not (str/starts-with? (first %) "sci.impl.")))
|
(take-while #(not (str/starts-with? (first %) "sci.impl.")))
|
||||||
(map render-native-stacktrace-elem))
|
(keep render-native-stacktrace-elem))
|
||||||
(.getStackTrace (or (ex-cause e) e)))
|
(.getStackTrace (or (ex-cause e) e)))
|
||||||
(sci/stacktrace e)))]
|
(sci/stacktrace e)))]
|
||||||
(if exit-code
|
(if exit-code
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
[sci.impl.interpreter :refer [eval-form]]
|
[sci.impl.interpreter :refer [eval-form]]
|
||||||
[sci.impl.io :as sio]
|
[sci.impl.io :as sio]
|
||||||
[sci.impl.parser :as parser]
|
[sci.impl.parser :as parser]
|
||||||
[sci.impl.vars :as vars]))
|
[sci.impl.utils :as utils]))
|
||||||
|
|
||||||
(set! *warn-on-reflection* true)
|
(set! *warn-on-reflection* true)
|
||||||
|
|
||||||
|
|
@ -80,7 +80,7 @@
|
||||||
(let [ret (eval-form sci-ctx expr)]
|
(let [ret (eval-form sci-ctx expr)]
|
||||||
ret))))
|
ret))))
|
||||||
:need-prompt (or need-prompt (fn [] true))
|
:need-prompt (or need-prompt (fn [] true))
|
||||||
:prompt (or prompt #(sio/printf "%s=> " (vars/current-ns-name)))
|
:prompt (or prompt #(sio/printf "%s=> " (utils/current-ns-name)))
|
||||||
:flush (or flush sio/flush)
|
:flush (or flush sio/flush)
|
||||||
:print (or print sio/prn)
|
:print (or print sio/prn)
|
||||||
:caught (or caught repl-caught)))))
|
:caught (or caught repl-caught)))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue