Skip to content

Commit 1e45bef

Browse files
committed
v0.3.31
1 parent 7bf9ac9 commit 1e45bef

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
For a list of breaking changes, check [here](#breaking-changes)
44

5+
## v0.3.31
6+
7+
- Fix `sci/copy-ns*`, the name was not copied correctly :(
8+
59
## v0.3.30
610

711
- Support globally valid `:ns-aliases` for mapping e.g. `clojure.test` to `cljs.test`

resources/SCI_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.30
1+
0.3.31

src/sci/core.cljc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,7 @@
8989
doc (assoc :doc doc)
9090
arglists (assoc :arglists arglists)
9191
dynamic (assoc :dynamic dynamic))]
92-
(cond dynamic
93-
(new-dynamic-var @clojure-var new-m)
94-
macro
95-
(new-macro-var @clojure-var new-m)
96-
:else (new-var nm @clojure-var new-m))))
92+
(new-var nm @clojure-var new-m)))
9793

9894
(macros/deftime
9995
(defmacro with-bindings

test/sci/core_test.cljc

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@
186186

187187
(deftest fn-test
188188
#_(is (thrown-with-msg?
189-
#?(:clj Exception :cljs js/Error) #"arg"
190-
(eval* '((fn foo [x] (if (< x 3) (foo 1 (inc x)) x)) 0))))
189+
#?(:clj Exception :cljs js/Error) #"arg"
190+
(eval* '((fn foo [x] (if (< x 3) (foo 1 (inc x)) x)) 0))))
191191
(is (= 3 (eval* '((fn foo [x] (if (< x 3) (foo (inc x)) x)) 0))))
192192
(is (= [2 3] (eval* '((fn foo [[x & xs]] xs) [1 2 3]))))
193193
(is (= [2 3] (eval* '((fn foo [x & xs] xs) 1 2 3))))
@@ -429,12 +429,12 @@
429429
(let [d (ex-data ex)]
430430
d))))
431431
#_(tu/assert-submap {:type :sci/error, :line 1, :column 25,
432-
:message #"Wrong number of args \(0\) passed to: user/foo"}
433-
(try (eval* (str "(defmacro foo [x & xs]) "
434-
"(foo)"))
435-
(catch #?(:clj clojure.lang.ExceptionInfo :cljs ExceptionInfo) ex
436-
(let [d (ex-data ex)]
437-
d))))))
432+
:message #"Wrong number of args \(0\) passed to: user/foo"}
433+
(try (eval* (str "(defmacro foo [x & xs]) "
434+
"(foo)"))
435+
(catch #?(:clj clojure.lang.ExceptionInfo :cljs ExceptionInfo) ex
436+
(let [d (ex-data ex)]
437+
d))))))
438438

439439
(deftest disable-arity-checks-test
440440
(is (thrown-with-msg? #?(:clj Exception :cljs js/Error)
@@ -1153,7 +1153,9 @@
11531153
sci-ns (update-vals* publics #(sci/copy-var* % ens))
11541154
ctx (sci/init {:namespaces {'edamame.core sci-ns}})
11551155
output (sci/eval-string* ctx "(require '[edamame.core :as e]) (e/parse-string \"1\")")]
1156-
(is (= 1 output))))
1156+
(is (= 1 output)))
1157+
(is (= 'inc (-> (sci/copy-var* #'inc (sci/create-ns 'clojure.core))
1158+
meta :name))))
11571159

11581160
(deftest data-readers-test
11591161
(is (= 2 (sci/eval-string "#t/tag 1" {:readers {'t/tag inc}})))
@@ -1373,9 +1375,9 @@
13731375
(deftest copy-ns-default-meta-test
13741376
(testing "copy-ns default meta includes name"
13751377
(let [sci-ns (sci/copy-ns sci.copy-ns-test-ns
1376-
(sci/create-ns 'sci.copy-ns-test-ns))]
1378+
(sci/create-ns 'sci.copy-ns-test-ns))]
13771379
(is (every? (fn [[var-name meta]] (and (symbol? var-name) (= var-name (:name meta))))
1378-
(map (fn [[name var]] (vector name (meta var))) sci-ns))))))
1380+
(map (fn [[name var]] (vector name (meta var))) sci-ns))))))
13791381

13801382
(deftest vswap-test
13811383
(is (= 2 (sci/eval-string
@@ -1425,7 +1427,7 @@
14251427

14261428
(deftest var-name-test
14271429
(testing "var name strings match their namespace and symbol"
1428-
(is (empty? (sci/eval-string "
1430+
(is (empty? (sci/eval-string "
14291431
(require '[clojure.string :as str])
14301432
(let [ns-maps (->> (all-ns)
14311433
(map (fn [nmspc] [(ns-name nmspc) (ns-publics nmspc)]))
@@ -1437,7 +1439,7 @@
14371439
var-meta-ns-name ((fnil ns-name (create-ns \"missing-ns\")) var-meta-ns)]]
14381440
; build a seq of maps containing the ns/symbol from the ns and the ns/symbol from the var's metadata
14391441
{:actual-ns ns-nm :actual-ns-symbol sym :var-meta-ns var-meta-ns-name :var-meta-name var-meta-name})
1440-
; remove the protocol/interface-ish vars whose metas don't really match
1442+
; remove the protocol/interface-ish vars whose metas don't really match
14411443
(remove (fn [{:keys [var-meta-name]}]
14421444
(str/starts-with? (name var-meta-name) \"cljs.core.\")))
14431445
(filter (complement #(and (= (:actual-ns %) (:var-meta-ns %)) (= (:actual-ns-symbol %) (:var-meta-name %)))))))")))))

0 commit comments

Comments
 (0)