[#557] Fix namespace change in REPL
This commit is contained in:
parent
a0da0d952b
commit
c4d05b4811
3 changed files with 10 additions and 5 deletions
|
|
@ -444,7 +444,8 @@ If neither -e, -f, or --socket-repl are specified, then the first argument that
|
||||||
(handle-sigint!)
|
(handle-sigint!)
|
||||||
(binding [*unrestricted* true]
|
(binding [*unrestricted* true]
|
||||||
(sci/binding [reflection-var false
|
(sci/binding [reflection-var false
|
||||||
core/data-readers @core/data-readers]
|
core/data-readers @core/data-readers
|
||||||
|
sci/ns @sci/ns]
|
||||||
(let [{version-opt :version
|
(let [{version-opt :version
|
||||||
:keys [:shell-in :edn-in :shell-out :edn-out
|
:keys [:shell-in :edn-in :shell-out :edn-out
|
||||||
:help? :file :command-line-args
|
:help? :file :command-line-args
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,9 @@
|
||||||
(vars/bindRoot sci/err *err*)
|
(vars/bindRoot sci/err *err*)
|
||||||
|
|
||||||
(defn repl! []
|
(defn repl! []
|
||||||
(sci/with-bindings {vars/current-ns (vars/->SciNamespace 'user nil)}
|
(start-repl! (init {:bindings {'*command-line-args*
|
||||||
(start-repl! (init {:bindings {'*command-line-args*
|
["a" "b" "c"]}
|
||||||
["a" "b" "c"]}
|
:env (atom {})})))
|
||||||
:env (atom {})}))))
|
|
||||||
|
|
||||||
(defn assert-repl [expr expected]
|
(defn assert-repl [expr expected]
|
||||||
(is (str/includes? (sci/with-out-str
|
(is (str/includes? (sci/with-out-str
|
||||||
|
|
|
||||||
|
|
@ -538,6 +538,11 @@
|
||||||
Exception #"preloads"
|
Exception #"preloads"
|
||||||
(test-utils/bb nil (.getPath (io/file "test-resources" "babashka" "file_location_preloads.clj")))))))
|
(test-utils/bb nil (.getPath (io/file "test-resources" "babashka" "file_location_preloads.clj")))))))
|
||||||
|
|
||||||
|
(deftest repl-test
|
||||||
|
(is (str/includes? (test-utils/bb "(ns foo) ::foo" "--repl") ":foo/foo"))
|
||||||
|
(is (str/includes? (test-utils/bb "[*warn-on-reflection* (set! *warn-on-reflection* true) *warn-on-reflection*]")
|
||||||
|
"[false true true]")))
|
||||||
|
|
||||||
;;;; Scratch
|
;;;; Scratch
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue