Fix #1368: -x: do not pick up on aliases in user ns
This commit is contained in:
parent
848683f82d
commit
3110dde2ab
3 changed files with 26 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ A preview of the next release can be installed from
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- [#1368](https://github.com/babashka/babashka/issues/1368): `-x`: do not pick up on aliases in `user` ns
|
||||||
- [#1367](https://github.com/babashka/babashka/issues/1367): Fix line number in clojure.test output ([@retrogradeorbit](https://github.com/retrogradeorbit))
|
- [#1367](https://github.com/babashka/babashka/issues/1367): Fix line number in clojure.test output ([@retrogradeorbit](https://github.com/retrogradeorbit))
|
||||||
- [#1370](https://github.com/babashka/babashka/issues/1370): Add `core.async` `to-chan!`, `to-chan!!`, `onto-chan!` ([@cap10morgan](https://github.com/cap10morgan))
|
- [#1370](https://github.com/babashka/babashka/issues/1370): Add `core.async` `to-chan!`, `to-chan!!`, `onto-chan!` ([@cap10morgan](https://github.com/cap10morgan))
|
||||||
- [#1358](https://github.com/babashka/babashka/issues/1358): Expose a subset of java.lang.ref to enable hooking into the destruction/GC of objects ([@retrogradeorbit](https://github.com/retrogradeorbit))
|
- [#1358](https://github.com/babashka/babashka/issues/1358): Expose a subset of java.lang.ref to enable hooking into the destruction/GC of objects ([@retrogradeorbit](https://github.com/retrogradeorbit))
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,11 @@
|
||||||
([sym] (exec-fn-snippet sym nil))
|
([sym] (exec-fn-snippet sym nil))
|
||||||
([sym extra-opts]
|
([sym extra-opts]
|
||||||
(format "
|
(format "
|
||||||
(do
|
(ns exec-%s
|
||||||
(require '[babashka.cli])
|
(:require [babashka.cli :as cli]))
|
||||||
(let [extra-opts '%2$s
|
(let [extra-opts '%s
|
||||||
the-var (requiring-resolve `%1$s)
|
sym `%s
|
||||||
|
the-var (requiring-resolve sym)
|
||||||
the-var-meta (meta the-var)
|
the-var-meta (meta the-var)
|
||||||
ns (:ns (meta the-var))
|
ns (:ns (meta the-var))
|
||||||
ns-meta (meta ns)
|
ns-meta (meta ns)
|
||||||
|
|
@ -28,6 +29,8 @@
|
||||||
task-exec-args (:exec-args ct)
|
task-exec-args (:exec-args ct)
|
||||||
cli-exec-args (:exec-args cli-opts)
|
cli-exec-args (:exec-args cli-opts)
|
||||||
opts (babashka.cli/merge-opts cli-exec-args task-exec-args opts)]
|
opts (babashka.cli/merge-opts cli-exec-args task-exec-args opts)]
|
||||||
(the-var opts)))"
|
(the-var opts))"
|
||||||
|
(random-uuid)
|
||||||
|
(pr-str extra-opts)
|
||||||
sym
|
sym
|
||||||
(pr-str extra-opts))))
|
)))
|
||||||
|
|
|
||||||
16
test/babashka/exec_test.clj
Normal file
16
test/babashka/exec_test.clj
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
(ns babashka.exec-test
|
||||||
|
(:require
|
||||||
|
[babashka.test-utils :as u]
|
||||||
|
[cheshire.core :as cheshire]
|
||||||
|
[clojure.edn :as edn]
|
||||||
|
[clojure.test :as t :refer [deftest is]]))
|
||||||
|
|
||||||
|
(defn bb [& args]
|
||||||
|
(apply u/bb nil args))
|
||||||
|
|
||||||
|
(deftest exec-test
|
||||||
|
(is (= {:foo 1} (edn/read-string (bb "-x" "prn" "--foo" "1"))))
|
||||||
|
(is (thrown? Exception (bb "-x" "json/generate-string" "--foo" "1")))
|
||||||
|
(is (= {:foo 1} (cheshire/parse-string
|
||||||
|
(edn/read-string
|
||||||
|
(bb "-x" "cheshire.core/generate-string" "--foo" "1")) true))))
|
||||||
Loading…
Reference in a new issue