make *source-path* bind to the same var as *file*

This commit is contained in:
Bob 2024-05-30 08:40:37 -04:00
parent e95141f9ae
commit 14e4dda82b
No known key found for this signature in database
3 changed files with 2 additions and 20 deletions

View file

@ -16,7 +16,7 @@ A preview of the next release can be installed from
- Partially Fix [#1695](https://github.com/babashka/babashka/issues/1695): make `*command-line-args*` value available in the REPL ([@bobisageek](https://github.com/bobisageek))
- Fix [#1686](https://github.com/babashka/babashka/issues/1686): do not fetch dependencies/invoke java for `version`, `help`, and `describe` options ([@bobisageek](https://github.com/bobisageek))
- [#1696](https://github.com/babashka/babashka/issues/1696): add `clojure.lang.DynamicClassLoader` constructors ([@bobisageek](https://github.com/bobisageek))
- [#1696](https://github.com/babashka/babashka/issues/1696): add `clojure.core/*source-path*` (unused) ([@bobisageek](https://github.com/bobisageek))
- [#1696](https://github.com/babashka/babashka/issues/1696): add `clojure.core/*source-path*` (points to the same sci var as `*file*`) ([@bobisageek](https://github.com/bobisageek))
- [#1696](https://github.com/babashka/babashka/issues/1696): add `clojure.main/with-read-known` ([@bobisageek](https://github.com/bobisageek))
- [#1696](https://github.com/babashka/babashka/issues/1696): add `clojure.core.server/repl-read` ([@bobisageek](https://github.com/bobisageek))

View file

@ -27,7 +27,6 @@
(def math-context (core-dynamic-var '*math-context*))
(def compile-path (core-dynamic-var '*compile-path* *compile-path*))
(def compiler-options (core-dynamic-var '*compiler-options*))
(def source-path (core-dynamic-var '*source-path*))
(defn read+string
"Added for compatibility. Must be used with
@ -168,7 +167,7 @@
'*math-context* math-context
'*compiler-options* compiler-options
'*compile-path* compile-path
'*source-path* source-path
'*source-path* sci/file
'with-precision (sci/copy-var with-precision clojure-core-ns)
'-with-precision (sci/copy-var -with-precision clojure-core-ns)
;; STM

View file

@ -1,17 +0,0 @@
(ns babashka.impl.clojure.core-test
(:require [babashka.test-utils :as tu]
[clojure.edn :as edn]
[clojure.test :as t :refer [deftest is testing]]))
(def bb
(comp edn/read-string tu/bb))
(deftest source-path-test
(testing "source path is nil by default"
(is (empty? (bb nil "*source-path*"))))
(testing "source path can be bound dynamically"
(is (= ["some_value.clj" nil]
(bb nil (pr-str '(let [x (binding [*source-path* "some_value.clj"]
*source-path*)
y *source-path*]
[x y])))))))