This commit is contained in:
Michiel Borkent 2020-09-22 11:54:51 +02:00
parent 7b575b9fae
commit 007c182da7
2 changed files with 8 additions and 6 deletions

2
sci

@ -1 +1 @@
Subproject commit 2f3760eb7c3f129adf044dadbe75ebed5f27921f Subproject commit fba06e91adf38568f82fce6323610501f57d44c3

View file

@ -136,19 +136,21 @@ user/foo - <expr>:1:1
user - <expr>:1:45"))) user - <expr>:1:45")))
(deftest error-in-macroexpansion-test (deftest error-in-macroexpansion-test
(let [output (try (tu/bb nil "-e" "(defmacro foo [x & xs] `(do (subs nil 1) ~x)) (foo 1)") (let [output (try (tu/bb nil "-e" "(defmacro foo [x] `(subs nil ~x)) (foo 1)")
(catch Exception e (ex-message e)))] (catch Exception e (ex-message e)))]
(multiline-equals output (multiline-equals output
"----- Error -------------------------------------------------------------------- "----- Error --------------------------------------------------------------------
Type: java.lang.NullPointerException Type: java.lang.NullPointerException
Location: <expr>:1:47 Location: <expr>:1:35
----- Context ------------------------------------------------------------------ ----- Context ------------------------------------------------------------------
1: (defmacro foo [x & xs] `(do (subs nil 1) ~x)) (foo 1) 1: (defmacro foo [x] `(subs nil ~x)) (foo 1)
^--- ^---
----- Stack trace -------------------------------------------------------------- ----- Stack trace --------------------------------------------------------------
clojure.core/subs - <built-in>")) clojure.core/subs - <built-in>
user - <expr>:1:35
"))
(testing "calling a var inside macroexpansion" (testing "calling a var inside macroexpansion"
(let [output (try (tu/bb nil "-e" "(defn quux [] (subs nil 1)) (defmacro foo [x & xs] `(do (quux) ~x)) (defn bar [] (foo 1)) (bar)") (let [output (try (tu/bb nil "-e" "(defn quux [] (subs nil 1)) (defmacro foo [x & xs] `(do (quux) ~x)) (defn bar [] (foo 1)) (bar)")
(catch Exception e (ex-message e)))] (catch Exception e (ex-message e)))]