Merge clojure and clojurescript tests

This commit is contained in:
Miloslav Nenadal 2016-02-21 16:02:20 +01:00
parent 4664f6db8c
commit d8d72e3e3b
5 changed files with 17 additions and 51 deletions

View file

@ -3,7 +3,7 @@ lein test pjstadig.humane-test-output.formatting-test
lein test :only pjstadig.humane-test-output.formatting-test/t-formatting lein test :only pjstadig.humane-test-output.formatting-test/t-formatting
FAIL in (t-formatting) (formatting_test.clj:6) FAIL in (t-formatting) (formatting_test.cljc:9)
FIXME, I fail. FIXME, I fail.
expected: {:foo :bar, expected: {:foo :bar,
:baz :quux, :baz :quux,
@ -18,7 +18,7 @@ expected: {:foo :bar,
lein test :only pjstadig.humane-test-output.formatting-test/t-formatting lein test :only pjstadig.humane-test-output.formatting-test/t-formatting
FAIL in (t-formatting) (formatting_test.clj:9) FAIL in (t-formatting) (formatting_test.cljc:12)
FIXME, I fail. FIXME, I fail.
expected: {:foo :bar, expected: {:foo :bar,
:baz :quux, :baz :quux,
@ -31,7 +31,7 @@ expected: {:foo :bar,
lein test :only pjstadig.humane-test-output.formatting-test/t-formatting lein test :only pjstadig.humane-test-output.formatting-test/t-formatting
FAIL in (t-formatting) (formatting_test.clj:12) FAIL in (t-formatting) (formatting_test.cljc:15)
FIXME, I fail. FIXME, I fail.
expected: {:foo :bar} expected: {:foo :bar}
actual: {:foo :bar, actual: {:foo :bar,
@ -44,7 +44,7 @@ expected: {:foo :bar}
lein test :only pjstadig.humane-test-output.formatting-test/t-formatting lein test :only pjstadig.humane-test-output.formatting-test/t-formatting
FAIL in (t-formatting) (formatting_test.clj:15) FAIL in (t-formatting) (formatting_test.cljc:18)
FIXME, I fail. FIXME, I fail.
expected: {:foo :bar, :baz :quux} expected: {:foo :bar, :baz :quux}
actual: {:foo :bar, :baz :quux} actual: {:foo :bar, :baz :quux}
@ -59,7 +59,7 @@ expected: {:foo :bar, :baz :quux}
lein test :only pjstadig.humane-test-output.formatting-test/t-formatting lein test :only pjstadig.humane-test-output.formatting-test/t-formatting
FAIL in (t-formatting) (formatting_test.clj:19) FAIL in (t-formatting) (formatting_test.cljc:22)
FIXME, I fail. FIXME, I fail.
expected: (list? foo) expected: (list? foo)
actual: (not actual: (not
@ -71,7 +71,7 @@ expected: (list? foo)
lein test :only pjstadig.humane-test-output.formatting-test/t-macro-wrapping lein test :only pjstadig.humane-test-output.formatting-test/t-macro-wrapping
FAIL in (t-macro-wrapping) (formatting_test.clj:26) FAIL in (t-macro-wrapping) (formatting_test.cljc:24)
expected: 1 expected: 1
actual: 2 actual: 2
diff: - 1 diff: - 1
@ -81,7 +81,7 @@ lein test pjstadig.humane-test-output.records-test
lein test :only pjstadig.humane-test-output.records-test/t-records lein test :only pjstadig.humane-test-output.records-test/t-records
FAIL in (t-records) (records_test.clj:9) FAIL in (t-records) (records_test.cljc:10)
these should not print as plain maps these should not print as plain maps
expected: #pjstadig.humane_test_output.records_test.ARecord{:foo :foo} expected: #pjstadig.humane_test_output.records_test.ARecord{:foo :foo}
actual: #pjstadig.humane_test_output.records_test.ARecord{:foo :bar} actual: #pjstadig.humane_test_output.records_test.ARecord{:foo :bar}
@ -90,17 +90,19 @@ expected: #pjstadig.humane_test_output.records_test.ARecord{:foo :foo}
lein test :only pjstadig.humane-test-output.records-test/t-records lein test :only pjstadig.humane-test-output.records-test/t-records
FAIL in (t-records) (records_test.clj:11) FAIL in (t-records) (records_test.cljc:12)
there should be a diff here there should be a diff here
expected: #pjstadig.humane_test_output.records_test.ARecord{:foo :foo} expected: #pjstadig.humane_test_output.records_test.ARecord{:foo :foo}
actual: {:foo :foo} actual: {:foo :foo}
lein test :only pjstadig.humane-test-output.records-test/t-records lein test :only pjstadig.humane-test-output.records-test/t-records
FAIL in (t-records) (records_test.clj:13) FAIL in (t-records) (records_test.cljc:14)
and here and here
expected: #pjstadig.humane_test_output.records_test.ARecord{:foo :foo} expected: #pjstadig.humane_test_output.records_test.ARecord{:foo :foo}
actual: #pjstadig.humane_test_output.records_test.BRecord{:foo :foo} actual: #pjstadig.humane_test_output.records_test.BRecord{:foo :foo}
lein test pjstadig.macro
Ran 3 tests containing 9 assertions. Ran 3 tests containing 9 assertions.
9 failures, 0 errors. 9 failures, 0 errors.

View file

@ -1,5 +1,8 @@
(ns pjstadig.humane-test-output.formatting-test (ns pjstadig.humane-test-output.formatting-test
(:use [clojure.test])) #?(:clj (:use [clojure.test]
[pjstadig.macro])
:cljs (:require-macros [cljs.test :refer [deftest testing is]]
[pjstadig.macro :refer [deftest+]])))
(deftest t-formatting (deftest t-formatting
(testing "FIXME, I fail." (testing "FIXME, I fail."
@ -18,9 +21,4 @@
:another-key "and another value"}] :another-key "and another value"}]
(is (list? foo))))) (is (list? foo)))))
(defmacro deftest+
[test-name expected actual]
`(deftest ~test-name
(is (= ~expected ~actual))))
(deftest+ t-macro-wrapping 1 2) (deftest+ t-macro-wrapping 1 2)

View file

@ -1,22 +0,0 @@
(ns pjstadig.humane-test-output.formatting-test
(:require-macros [cljs.test :refer [deftest testing is]]
[pjstadig.macro :refer [deftest+]]))
(deftest t-formatting
(testing "FIXME, I fail."
(is (= {:foo :bar :baz :quux :something "a long string?"
:another-key "and another value"}
{:fo :bar}))
(is (= {:foo :bar :baz :quux :something "a long string?"
:another-key "and another value"}
{:foo :bar}))
(is (= {:foo :bar}
{:foo :bar :baz :quux :something "a long string?"
:another-key "and another value"}))
(is (= {:foo :bar :baz :quux} {:foo :bar :baz :quux} {:fo :bar :baz :quux}
{:fo :bar :baz :quux}))
(let [foo {:foo :bar :baz :quux :something "a long string?"
:another-key "and another value"}]
(is (list? foo)))))
(deftest+ t-macro-wrapping 1 2)

View file

@ -1,5 +1,6 @@
(ns pjstadig.humane-test-output.records-test (ns pjstadig.humane-test-output.records-test
(:use [clojure.test])) #?(:clj (:use [clojure.test])
:cljs (:require-macros [cljs.test :refer [deftest testing is]])))
(defrecord ARecord [foo]) (defrecord ARecord [foo])
(defrecord BRecord [foo]) (defrecord BRecord [foo])

View file

@ -1,13 +0,0 @@
(ns pjstadig.humane-test-output.records-test
(:require-macros [cljs.test :refer [deftest testing is]]))
(defrecord ARecord [foo])
(defrecord BRecord [foo])
(deftest t-records
(testing "these should not print as plain maps"
(is (= (->ARecord :foo) (->ARecord :bar))))
(testing "there should be a diff here"
(is (= (->ARecord :foo) {:foo :foo})))
(testing "and here"
(is (= (->ARecord :foo) (->BRecord :foo)))))