Fix remaining args when invoking -m
This commit is contained in:
parent
73426de206
commit
19415f6363
3 changed files with 6 additions and 7 deletions
|
|
@ -585,8 +585,8 @@ Use bb run --help to show this help output.
|
||||||
(update opts-map :expressions (fnil conj []) (first options))))
|
(update opts-map :expressions (fnil conj []) (first options))))
|
||||||
("--main", "-m",)
|
("--main", "-m",)
|
||||||
(let [options (next options)]
|
(let [options (next options)]
|
||||||
(recur (next options)
|
(assoc opts-map :main (first options)
|
||||||
(assoc opts-map :main (first options))))
|
:command-line-args (rest options)))
|
||||||
("--run")
|
("--run")
|
||||||
(parse-run-opts opts-map (next options))
|
(parse-run-opts opts-map (next options))
|
||||||
("--tasks")
|
("--tasks")
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,8 @@
|
||||||
(let [v (bb nil "--describe")]
|
(let [v (bb nil "--describe")]
|
||||||
(is (:babashka/version v))
|
(is (:babashka/version v))
|
||||||
(is (:feature/xml v)))
|
(is (:feature/xml v)))
|
||||||
(is (= {:force? true} (main/parse-opts ["--force"]))))
|
(is (= {:force? true} (main/parse-opts ["--force"])))
|
||||||
|
(is (= {:main "foo", :command-line-args '("-h")} (main/parse-opts ["-m" "foo" "-h"]))))
|
||||||
|
|
||||||
(deftest version-test
|
(deftest version-test
|
||||||
(is (= [1 0 0] (main/parse-version "1.0.0-SNAPSHOT")))
|
(is (= [1 0 0] (main/parse-version "1.0.0-SNAPSHOT")))
|
||||||
|
|
@ -217,7 +218,6 @@
|
||||||
(testing "init with a task name after it"
|
(testing "init with a task name after it"
|
||||||
(test-utils/with-config '{:tasks {thing (println (init-test/do-a-thing))}} ; make a task available
|
(test-utils/with-config '{:tasks {thing (println (init-test/do-a-thing))}} ; make a task available
|
||||||
(is (= "foo\n" (test-utils/bb nil "--init" "test-resources/babashka/init_test.clj" "thing"))))))
|
(is (= "foo\n" (test-utils/bb nil "--init" "test-resources/babashka/init_test.clj" "thing"))))))
|
||||||
|
|
||||||
|
|
||||||
(deftest preloads-test
|
(deftest preloads-test
|
||||||
;; THIS TEST REQUIRES:
|
;; THIS TEST REQUIRES:
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
(ns babashka.uberscript-test
|
(ns babashka.uberscript-test
|
||||||
(:require
|
(:require
|
||||||
[babashka.test-utils :as tu]
|
[babashka.test-utils :as tu]
|
||||||
[clojure.edn :as edn]
|
|
||||||
[clojure.test :as t :refer [deftest is testing]]))
|
[clojure.test :as t :refer [deftest is testing]]))
|
||||||
|
|
||||||
(deftest uberscript-test
|
(deftest uberscript-test
|
||||||
(let [tmp-file (java.io.File/createTempFile "uberscript" ".clj")]
|
(let [tmp-file (java.io.File/createTempFile "uberscript" ".clj")]
|
||||||
(.deleteOnExit tmp-file)
|
(.deleteOnExit tmp-file)
|
||||||
(is (empty? (tu/bb nil "--classpath" "test-resources/babashka/src_for_classpath_test" "-m" "my.main" "--uberscript" (.getPath tmp-file))))
|
(is (empty? (tu/bb nil "--classpath" "test-resources/babashka/src_for_classpath_test" "uberscript" (.getPath tmp-file) "-m" "my.main" )))
|
||||||
(is (= "(\"1\" \"2\" \"3\" \"4\")\n"
|
(is (= "(\"1\" \"2\" \"3\" \"4\")\n"
|
||||||
(tu/bb nil "--file" (.getPath tmp-file) "1" "2" "3" "4")))
|
(tu/bb nil "--file" (.getPath tmp-file) "1" "2" "3" "4")))
|
||||||
(testing "order of namespaces is correct"
|
(testing "order of namespaces is correct"
|
||||||
(tu/bb nil "--classpath" "test-resources/babashka/uberscript/src" "-m" "my.main" "--uberscript" (.getPath tmp-file))
|
(tu/bb nil "--classpath" "test-resources/babashka/uberscript/src" "uberscript" (.getPath tmp-file) "-m" "my.main")
|
||||||
(is (= "(\"1\" \"2\" \"3\" \"4\")\n"
|
(is (= "(\"1\" \"2\" \"3\" \"4\")\n"
|
||||||
(tu/bb nil "--file" (.getPath tmp-file) "1" "2" "3" "4"))))))
|
(tu/bb nil "--file" (.getPath tmp-file) "1" "2" "3" "4"))))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue