[#329] ignore non-existing ns in nREPL message
This commit is contained in:
parent
c785a1d1f6
commit
2272536026
2 changed files with 10 additions and 4 deletions
|
|
@ -41,11 +41,10 @@
|
|||
(defn eval-msg [ctx o msg #_threads]
|
||||
(try
|
||||
(let [ns-str (get msg :ns)
|
||||
sci-ns (when ns-str (sci-utils/namespace-object (:env ctx) (symbol ns-str) nil false))
|
||||
sw (StringWriter.)]
|
||||
(sci/with-bindings (cond-> {sci/out sw}
|
||||
ns-str
|
||||
(assoc vars/current-ns
|
||||
(sci-utils/namespace-object (:env ctx) (symbol ns-str) nil false)))
|
||||
sci-ns (assoc vars/current-ns sci-ns))
|
||||
(when @dev? (println "current ns" (vars/current-ns-name)))
|
||||
(let [session (get msg :session "none")
|
||||
id (get msg :id "unknown")]
|
||||
|
|
|
|||
|
|
@ -68,7 +68,14 @@
|
|||
"session" session
|
||||
"id" (new-id!)
|
||||
"ns" "ns0"})
|
||||
(is (= ":foo0" (:value (read-reply in session @id)))))))
|
||||
(is (= ":foo0" (:value (read-reply in session @id)))))
|
||||
(testing "providing an ns value of a non-existing namespace falls back the last defined namespace"
|
||||
(bencode/write-bencode os {"op" "eval"
|
||||
"code" "(foo)"
|
||||
"session" session
|
||||
"id" (new-id!)
|
||||
"ns" "unicorn"})
|
||||
(is (= ":foo1" (:value (read-reply in session @id)))))))
|
||||
(testing "load-file"
|
||||
(bencode/write-bencode os {"op" "load-file" "file" "(ns foo) (defn foo [] :foo)" "session" session "id" (new-id!)})
|
||||
(read-reply in session @id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue