Skip to content

Commit

Permalink
ok? to 2xx?
Browse files Browse the repository at this point in the history
  • Loading branch information
vganshin committed Sep 18, 2019
1 parent e57c8a9 commit 7db4ba3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/.#matcho.clj
14 changes: 11 additions & 3 deletions src/matcho.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
(:require [clojure.string :as s]))

(def fns
{"ok?" #(and (> % 199) (< % 300))
"4xx?" #(and (> % 400) (< % 500))
"5xx?" #(and (> % 500) (< % 600))
{"2xx?" #(and (>= % 200) (< % 300))
"4xx?" #(and (>= % 400) (< % 500))
"5xx?" #(and (>= % 500) (< % 600))
}
)


(comment



(pr-str (with-meta #(and %1 %2) {:type "wow"}))


)
(defn built-in-fn [fn-name]
(if-let [func (ns-resolve 'clojure.core (symbol fn-name))]
#(func %)
Expand Down
1 change: 0 additions & 1 deletion src/runner.clj
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@
(doseq [test-case (:test-cases result)]
(println (:id test-case))))

(vv conf (clojure.pprint/pprint result))
(assoc result :passed? (zero? (:failed-tests sum)))))

(comment
Expand Down
4 changes: 2 additions & 2 deletions test/matcho_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

(is (empty? (sut/match {:a "str"} {:a "#str"})))

(is (empty? (sut/match {:a 200} {:a "ok?"})))
(is (empty? (sut/match {:a 200} {:a "2xx?"})))

(is (empty? (sut/match {:a 204} {:a "ok?"})))
(is (empty? (sut/match {:a 204} {:a "2xx?"})))

(is (empty? (sut/match {:a "string"} {:a "#str\\w+"})))

Expand Down

0 comments on commit 7db4ba3

Please sign in to comment.