tests working in clojurescript but no runner yet
This commit is contained in:
parent
aeb86ab396
commit
9bef1c6528
2 changed files with 8 additions and 10 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
#?(:cljs (:require-macros
|
#?(:cljs (:require-macros
|
||||||
[cljs.test :refer [is deftest]]
|
[cljs.test :refer [is deftest]]
|
||||||
[cljs.test.check.cljs-test :refer [defspec]]
|
[cljs.test.check.cljs-test :refer [defspec]]
|
||||||
[com.rpl.specter.test-helpers :refer [for-all+]]))
|
[com.rpl.specter.cljs-test-helpers :refer [for-all+]]))
|
||||||
(:use
|
(:use
|
||||||
#?(:clj [clojure.test :only [deftest is]])
|
#?(:clj [clojure.test :only [deftest is]])
|
||||||
#?(:clj [clojure.test.check.clojure-test :only [defspec]])
|
#?(:clj [clojure.test.check.clojure-test :only [defspec]])
|
||||||
|
|
@ -10,8 +10,9 @@
|
||||||
[com.rpl.specter.protocols :only [comp-paths*]])
|
[com.rpl.specter.protocols :only [comp-paths*]])
|
||||||
(:require #?@(:clj [[clojure.test.check.generators :as gen]
|
(:require #?@(:clj [[clojure.test.check.generators :as gen]
|
||||||
[clojure.test.check.properties :as prop]]
|
[clojure.test.check.properties :as prop]]
|
||||||
:cljs [[cljs.test.check.generators :as gen]
|
:cljs [[cljs.test.check :as tc]
|
||||||
[cljs.test.check.properties :as prop]]
|
[cljs.test.check.generators :as gen]
|
||||||
|
[cljs.test.check.properties :as prop :include-macros true]]
|
||||||
)
|
)
|
||||||
[com.rpl.specter :as s]))
|
[com.rpl.specter :as s]))
|
||||||
|
|
||||||
|
|
@ -20,6 +21,7 @@
|
||||||
;; test keypath
|
;; test keypath
|
||||||
;; test comp-structure-paths
|
;; test comp-structure-paths
|
||||||
|
|
||||||
|
|
||||||
(defn limit-size [n {gen :gen}]
|
(defn limit-size [n {gen :gen}]
|
||||||
(gen/->Generator
|
(gen/->Generator
|
||||||
(fn [rnd _size]
|
(fn [rnd _size]
|
||||||
|
|
@ -60,7 +62,7 @@
|
||||||
))
|
))
|
||||||
|
|
||||||
(deftest select-one-test
|
(deftest select-one-test
|
||||||
(is (thrown? Exception (s/select-one [s/ALL even?] [1 2 3 4])))
|
(is (thrown? #?(:clj Exception :cljs js/Error) (s/select-one [s/ALL even?] [1 2 3 4])))
|
||||||
(is (= 1 (s/select-one [s/ALL odd?] [2 4 1 6])))
|
(is (= 1 (s/select-one [s/ALL odd?] [2 4 1 6])))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -391,5 +393,5 @@
|
||||||
|
|
||||||
(deftest nil-select-one-test
|
(deftest nil-select-one-test
|
||||||
(is (= nil (s/select-one! s/ALL [nil])))
|
(is (= nil (s/select-one! s/ALL [nil])))
|
||||||
(is (thrown? Exception (s/select-one! s/ALL [])))
|
(is (thrown? #?(:clj Exception :cljs js/Error) (s/select-one! s/ALL [])))
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
(ns com.rpl.specter.test-helpers
|
(ns com.rpl.specter.test-helpers
|
||||||
(:use [clojure.test]
|
|
||||||
[clojure.test.check.clojure-test])
|
|
||||||
(:require [clojure.test.check
|
(:require [clojure.test.check
|
||||||
[generators :as gen]
|
[generators :as gen]
|
||||||
[properties :as prop]]
|
[properties :as prop]]))
|
||||||
[clojure.test.check :as qc]
|
|
||||||
[clojure.pprint :as pp]))
|
|
||||||
|
|
||||||
|
|
||||||
;; it seems like gen/bind and gen/return are a monad (hence the names)
|
;; it seems like gen/bind and gen/return are a monad (hence the names)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue