Added concat-str-vec with string-vector? pred

This commit is contained in:
Clemens Geibel 2022-07-29 12:39:40 +02:00
parent d644e81345
commit c3a14c96d1
3 changed files with 18 additions and 2 deletions

View file

@ -58,6 +58,11 @@
(into []
(apply concat vs)))
(defn-spec concat-str-vec cp/string-vector?
[& vs (s/* seq?)]
(into []
(apply concat vs)))
(defn generate-common [my-config my-auth config-defaults k8s-objects]
(let [resulting-config (merge config-defaults my-config my-auth)]
(cs/join

View file

@ -14,7 +14,7 @@
(and (string? input)
(some? (re-matches #"(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)" input))))
(defn string-of-separated-by?
(defn string-of-separated-by?
[spec-function separator input]
(every? true? (map spec-function (str/split input separator))))
@ -44,3 +44,9 @@
(fqdn-string? (first split-string))
(port-number? (edn/read-string (second split-string)))))))
(defn string-vector?
[input]
(and (vector? input)
(every? true?
(map #(string? %) input))))

View file

@ -49,4 +49,9 @@
(is (true? (cut/host-and-port-string? "test.de:1234")))
(is (false? (cut/host-and-port-string? "test.de,1234")))
(is (false? (cut/host-and-port-string? "test.123:1234")))
(is (false? (cut/host-and-port-string? "test.de:abc"))))
(is (false? (cut/host-and-port-string? "test.de:abc"))))
(deftest test-string-vector?
(is (true? (cut/string-vector? ["hallo" "welt" "!"])))
(is (false? (cut/string-vector? ["hallo" 1 "welt" "!"])))
(is (false? (cut/string-vector? "hallo welt!"))))