Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selfhost ns form clobbering #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -8,5 +8,8 @@

(ns bootstrap-test.helper)

(defn bar [a b]
(defn multiply-form [a b]
`(* ~a ~b))

(defn multiply-fn [a b]
(* a b))
4 changes: 2 additions & 2 deletions src/test/self/bootstrap_test/macros.clj
Expand Up @@ -7,7 +7,7 @@
;; You must not remove this notice, or any other, from this software.

(ns bootstrap-test.macros
(:require [bootstrap-test.helper :refer [bar]]))
(:require [bootstrap-test.helper :refer [multiply-form]]))

(defmacro foo [a b]
(bar a b))
(multiply-form a b))
19 changes: 14 additions & 5 deletions src/test/self/self_host/test.cljs
Expand Up @@ -41,7 +41,7 @@
(def libs
{'bootstrap-test.core :cljs
'bootstrap-test.macros :clj
'bootstrap-test.helper :clj})
'bootstrap-test.helper :cljc})

(defn node-load [{:keys [name macros]} cb]
(if (contains? libs name)
Expand Down Expand Up @@ -842,9 +842,9 @@

(deftest test-eval-str-with-require
(async done
(let [l (latch 3 done)]
(let [l (latch 4 done)]
(cljs/eval-str st
"(ns foo.bar (:require [bootstrap-test.core]))\n(bootstrap-test.core/foo 3 4)"
"(ns foo.bar-1 (:require [bootstrap-test.core]))\n(bootstrap-test.core/foo 3 4)"
nil
{:eval node-eval
:load node-load}
Expand All @@ -853,7 +853,16 @@
(is (== 7 value))
(inc! l)))
(cljs/eval-str st
"(ns foo.bar (:require-macros [bootstrap-test.macros :refer [foo]]))\n(foo 4 4)"
"(ns foo.bar-2 (:require [bootstrap-test.helper :refer [multiply-fn]]))\n(ns foo.bar-2)\n(multiply-fn 4 4)"
nil
{:eval node-eval
:load node-load}
(fn [{:keys [error value]}]
(is (nil? error))
(is (== 16 value))
(inc! l)))
(cljs/eval-str st
"(ns foo.bar-3 (:require-macros [bootstrap-test.macros :refer [foo]]))\n(ns foo.bar-3)\n(foo 4 4)"
nil
{:eval node-eval
:load node-load}
Expand All @@ -862,7 +871,7 @@
(is (== 16 value))
(inc! l)))
(cljs/eval-str st
"(ns foo.bar)\n(first [1 2 3])"
"(ns foo.bar-4)\n(first [1 2 3])"
nil
{:eval node-eval
:load node-load}
Expand Down