Skip to content

Commit

Permalink
Add test for bbin install ./foo
Browse files Browse the repository at this point in the history
  • Loading branch information
rads committed Apr 26, 2024
1 parent 39ea43d commit b78caee
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/babashka/bbin/scripts_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,30 @@
(is (= "Hello world" (run-bin-script :hello)))
(is (= {'hello {:coords {:bbin/url script-url}}} (run-ls))))))

(deftest install-from-local-root-no-extension-test
(testing "install ./* (no extension, with shebang)"
(reset-test-dir)
(dirs/ensure-bbin-dirs {})
(let [script-file (doto (fs/file test-dir "hello")
(spit "#!/usr/bin/env bb\n(println \"Hello world\")"))
script-url (str "file:https://" script-file)
cli-opts {:script/lib (str script-file)}
out (run-install cli-opts)]
(is (= {:coords {:bbin/url (str "file:https://" script-file)}} out))
(is (= "Hello world" (run-bin-script :hello)))
(is (= {'hello {:coords {:bbin/url script-url}}} (run-ls)))))
(testing "install ./* (no extension, without shebang)"
(reset-test-dir)
(dirs/ensure-bbin-dirs {})
(let [script-file (doto (fs/file test-dir "hello")
(spit "(println \"Hello world\")"))
script-url (str "file:https://" script-file)
cli-opts {:script/lib (str script-file)}
out (run-install cli-opts)]
(is (= {:coords {:bbin/url (str "file:https://" script-file)}} out))
(is (= "Hello world" (run-bin-script :hello)))
(is (= {'hello {:coords {:bbin/url script-url}}} (run-ls))))))

(deftest install-from-local-root-jar-test
(testing "install ./*.jar"
(reset-test-dir)
Expand Down

0 comments on commit b78caee

Please sign in to comment.