From 7db4ba3ed999e36eed3f90f0a3452d158e35170d Mon Sep 17 00:00:00 2001 From: Vladislav Ganshin Date: Wed, 18 Sep 2019 11:09:32 +0300 Subject: [PATCH] ok? to 2xx? --- src/.#matcho.clj | 1 + src/matcho.clj | 14 +++++++++++--- src/runner.clj | 1 - test/matcho_test.clj | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) create mode 120000 src/.#matcho.clj diff --git a/src/.#matcho.clj b/src/.#matcho.clj new file mode 120000 index 0000000..d0f4fcc --- /dev/null +++ b/src/.#matcho.clj @@ -0,0 +1 @@ +vganshin@MacBook-Pro-Vladislav.local.74911 \ No newline at end of file diff --git a/src/matcho.clj b/src/matcho.clj index 656405c..77b6b09 100644 --- a/src/matcho.clj +++ b/src/matcho.clj @@ -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 %) diff --git a/src/runner.clj b/src/runner.clj index 86ee276..16168ec 100644 --- a/src/runner.clj +++ b/src/runner.clj @@ -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 diff --git a/test/matcho_test.clj b/test/matcho_test.clj index 856a902..7888665 100644 --- a/test/matcho_test.clj +++ b/test/matcho_test.clj @@ -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+"})))