[#498] Fix for invoking -f with empty file
This commit is contained in:
parent
ede2916c6b
commit
8a75a70bbe
3 changed files with 15 additions and 1 deletions
|
|
@ -544,7 +544,7 @@ If neither -e, -f, or --socket-repl are specified, then the first argument that
|
|||
repl [(repl/start-repl! sci-ctx) 0]
|
||||
socket-repl [(start-socket-repl! socket-repl sci-ctx) 0]
|
||||
nrepl [(start-nrepl! nrepl sci-ctx) 0]
|
||||
(not (str/blank? expression))
|
||||
expressions
|
||||
(try
|
||||
(loop []
|
||||
(let [in (read-next *in*)]
|
||||
|
|
|
|||
0
test-resources/babashka/empty.clj
Normal file
0
test-resources/babashka/empty.clj
Normal file
|
|
@ -1,4 +1,5 @@
|
|||
(ns babashka.main-test
|
||||
{:clj-kondo/config '{:linters {:unresolved-symbol {:exclude [working?]}}}}
|
||||
(:require
|
||||
[babashka.main :as main]
|
||||
[babashka.test-utils :as test-utils]
|
||||
|
|
@ -489,6 +490,19 @@
|
|||
(is (= "true\ntrue\nfalse\n"
|
||||
(test-utils/bb nil (.getPath (io/file "test-resources" "babashka" "version.clj"))))))
|
||||
|
||||
|
||||
(defmethod clojure.test/assert-expr 'working? [msg form]
|
||||
(let [body (next form)]
|
||||
`(do ~@body
|
||||
(clojure.test/do-report {:type :pass, :message ~msg,
|
||||
:expected :success, :actual :success}))))
|
||||
|
||||
(deftest empty-expressions-test
|
||||
(testing "bb executes the empty file and doesn't start a REPL"
|
||||
(is (working? (test-utils/bb nil (.getPath (io/file "test-resources" "babashka" "empty.clj"))))))
|
||||
(testing "bb executes the empty expression and doesn't start a REPL"
|
||||
(is (working? (test-utils/bb nil "-e" "")))))
|
||||
|
||||
;;;; Scratch
|
||||
|
||||
(comment
|
||||
|
|
|
|||
Loading…
Reference in a new issue