Account for repl urls with paths [fixes #1344, again]
This commit is contained in:
parent
c4446fc531
commit
3e865aedf2
2 changed files with 15 additions and 11 deletions
|
@ -48,7 +48,7 @@
|
||||||
port)))
|
port)))
|
||||||
|
|
||||||
(defn ensure-port [s]
|
(defn ensure-port [s]
|
||||||
(if (re-find #":\d+$" s)
|
(if (re-find #":\d+($|/.*$)" s)
|
||||||
s
|
s
|
||||||
(main/abort "Port is required. See `lein help repl`")))
|
(main/abort "Port is required. See `lein help repl`")))
|
||||||
|
|
||||||
|
|
|
@ -73,19 +73,23 @@
|
||||||
"" "repl-host:5"
|
"" "repl-host:5"
|
||||||
"7" "repl-host:7"
|
"7" "repl-host:7"
|
||||||
"myhost:9" "myhost:9"
|
"myhost:9" "myhost:9"
|
||||||
"http://localhost:20" "http://localhost:20")
|
"http://localhost:20" "http://localhost:20"
|
||||||
|
"http://localhost:20/ham" "http://localhost:20/ham")
|
||||||
(with-redefs [repl-host (constantly "repl-host")
|
(with-redefs [repl-host (constantly "repl-host")
|
||||||
repl-port (constantly 0)]
|
repl-port (constantly 0)]
|
||||||
(is (= "repl-host:1" (connect-string {} ["1"])))
|
(is (= "repl-host:1" (connect-string {} ["1"])))
|
||||||
(is (= "repl-host:123" (connect-string {} ["123"])))
|
(is (= "repl-host:123" (connect-string {} ["123"])))
|
||||||
|
(are [in proj]
|
||||||
(is (re-find
|
(is (re-find
|
||||||
#"Port is required"
|
#"Port is required"
|
||||||
(lthelper/abort-msg connect-string {} []))))
|
(lthelper/abort-msg connect-string proj in)))
|
||||||
|
["http://localhost/ham"] {}
|
||||||
|
["foo1234"] {}
|
||||||
|
[] {}
|
||||||
|
[] lthelper/with-resources-project))
|
||||||
|
|
||||||
(is (= "127.0.0.1:4242" (connect-string lthelper/sample-project [])))
|
(is (= "127.0.0.1:4242" (connect-string lthelper/sample-project [])))
|
||||||
(is (= "127.0.0.1:4343" (connect-string lthelper/sample-project ["4343"])))
|
(is (= "127.0.0.1:4343" (connect-string lthelper/sample-project ["4343"])))
|
||||||
(is (re-find
|
|
||||||
#"Port is required"
|
|
||||||
(lthelper/abort-msg connect-string lthelper/with-resources-project [])))
|
|
||||||
(is (= "127.0.0.1:4242" (connect-string lthelper/with-resources-project ["4242"]))))
|
(is (= "127.0.0.1:4242" (connect-string lthelper/with-resources-project ["4242"]))))
|
||||||
|
|
||||||
(deftest test-options-for-reply
|
(deftest test-options-for-reply
|
||||||
|
|
Loading…
Reference in a new issue