diff --git a/src/babashka/main.clj b/src/babashka/main.clj index 948ebc72..ed7bc57c 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -444,7 +444,8 @@ If neither -e, -f, or --socket-repl are specified, then the first argument that (handle-sigint!) (binding [*unrestricted* true] (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 :keys [:shell-in :edn-in :shell-out :edn-out :help? :file :command-line-args diff --git a/test/babashka/impl/repl_test.clj b/test/babashka/impl/repl_test.clj index 8c80e51b..4648a4a8 100644 --- a/test/babashka/impl/repl_test.clj +++ b/test/babashka/impl/repl_test.clj @@ -14,10 +14,9 @@ (vars/bindRoot sci/err *err*) (defn repl! [] - (sci/with-bindings {vars/current-ns (vars/->SciNamespace 'user nil)} - (start-repl! (init {:bindings {'*command-line-args* - ["a" "b" "c"]} - :env (atom {})})))) + (start-repl! (init {:bindings {'*command-line-args* + ["a" "b" "c"]} + :env (atom {})}))) (defn assert-repl [expr expected] (is (str/includes? (sci/with-out-str diff --git a/test/babashka/main_test.clj b/test/babashka/main_test.clj index aed4bacd..6d3ec7ac 100644 --- a/test/babashka/main_test.clj +++ b/test/babashka/main_test.clj @@ -538,6 +538,11 @@ Exception #"preloads" (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 (comment