Fix #1652: allow bb.edn to be empty

This commit is contained in:
Michiel Borkent 2024-01-09 12:26:20 +01:00
parent 5b471cb5e2
commit d85c86af2c
4 changed files with 6 additions and 2 deletions

View file

@ -14,6 +14,7 @@ A preview of the next release can be installed from
- Allow `catch` to be used as var name
- [#1646](https://github.com/babashka/babashka/issues/1646): command-line-args are dropped when file exists with same name
- [#1645](https://github.com/babashka/babashka/issues/1645): Support for clojure.lang.LongRange
- [#1652](https://github.com/babashka/babashka/issues/1652): allow `bb.edn` to be empty
## 1.3.186 (2023-11-02)

2
fs

@ -1 +1 @@
Subproject commit 40fcceb22b9728fee1c2ce0e58e390e5fe23f2cd
Subproject commit aed36f10bda703018a30f8971ebe2c1c3db76726

View file

@ -1113,7 +1113,7 @@ Use bb run --help to show this help output.
(>= patch-current patch-min)))))))
(defn read-bb-edn [string]
(try (edn/read-string {:default tagged-literal} string)
(try (edn/read-string {:default tagged-literal :eof nil} string)
(catch java.lang.RuntimeException e
(if (re-find #"No dispatch macro for: \"" (.getMessage e))
(throw (ex-info "Invalid regex literal found in EDN config, use re-pattern instead" {}))

View file

@ -533,6 +533,9 @@ even more stuff here\"
(deftest non-existing-tasks-in-run-gives-exit-code-1
(is (thrown? Exception (bb "-Sdeps" "{:tasks {foo {:task (run (quote bar))}}}" "foo"))))
(deftest empty-bb-edn-test
(is (= 6 (bb "-Sdeps" "" "-e" "(+ 1 2 3)"))))
(deftest warning-on-override-task
(when-not tu/native?
(binding [*out* *err*]