Skip to content

Commit 1e3f2d6

Browse files
authored
Merge pull request #37 from dgr/dgr-add-when-var-exists
Wrap all tests in `when-var-exists`
2 parents 1e80ede + 5672862 commit 1e3f2d6

File tree

100 files changed

+3804
-3614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+3804
-3614
lines changed

test/clojure/core_test/abs.cljc

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
(ns clojure.core-test.abs
2-
(:require [clojure.test :as t]))
2+
(:require [clojure.test :as t :refer [deftest testing is are]]
3+
[clojure.core-test.portability :as p]))
34

4-
(t/deftest common
5-
(t/is (thrown? NullPointerException (abs nil)))
6-
(t/are [in ex] (= ex (abs in))
7-
-1 1
8-
1 1
9-
Long/MIN_VALUE Long/MIN_VALUE ; Special case!
10-
-1.0 1.0
11-
-0.0 0.0
12-
##-Inf ##Inf
13-
##Inf ##Inf
14-
-123.456M 123.456M
15-
-123N 123N
16-
-1/5 1/5)
17-
(t/is (NaN? (abs ##NaN))))
5+
(p/when-var-exists clojure.core/abs
6+
(deftest test-abs
7+
(testing "common"
8+
(are [in ex] (= ex (abs in))
9+
-1 1
10+
1 1
11+
Long/MIN_VALUE Long/MIN_VALUE ; Special case!
12+
-1.0 1.0
13+
-0.0 0.0
14+
##-Inf ##Inf
15+
##Inf ##Inf
16+
-123.456M 123.456M
17+
-123N 123N
18+
-1/5 1/5)
19+
(is (NaN? (abs ##NaN)))
20+
(is (thrown? NullPointerException (abs nil))))
1821

19-
(t/deftest unboxed
20-
(let [a 42
21-
b -42
22-
a' (abs a)
23-
b' (abs b)]
24-
(t/is (= 42 a'))
25-
(t/is (= 42 b'))))
22+
(testing "unboxed"
23+
(let [a 42
24+
b -42
25+
a' (abs a)
26+
b' (abs b)]
27+
(is (= 42 a'))
28+
(is (= 42 b'))))))

test/clojure/core_test/aclone.cljc

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
(ns clojure.core-test.aclone
2-
(:require [clojure.test :as t :refer [deftest is]]))
2+
(:require [clojure.test :as t :refer [deftest testing is are]]
3+
[clojure.core-test.portability :as p]))
34

4-
(defn clone-test
5-
[a b]
6-
(aset a 0 1)
7-
(aset a 1 2)
8-
(aset a 2 3)
9-
(let [a' (aclone a)
10-
b' (aclone b)]
11-
(is (= 3 (alength a')))
12-
(is (every? identity (map #(= (aget a %) (aget a' %)) (range 3))))
13-
(is (zero? (alength b')))
14-
(is (not (identical? a a')))
15-
(is (not (identical? b b')))
16-
(aset a 1 11)
17-
(is (= 11 (aget a 1)))
18-
(is (= 2 (aget a' 1)))
19-
(aset a' 2 12)
20-
(is (= 3 (aget a 2)))
21-
(is (= 12 (aget a' 2)))))
5+
(p/when-var-exists clojure.core/aclone
6+
(defn clone-test
7+
[a b]
8+
(aset a 0 1)
9+
(aset a 1 2)
10+
(aset a 2 3)
11+
(let [a' (aclone a)
12+
b' (aclone b)]
13+
(is (= 3 (alength a')))
14+
(is (every? identity (map #(= (aget a %) (aget a' %)) (range 3))))
15+
(is (zero? (alength b')))
16+
(is (not (identical? a a')))
17+
(is (not (identical? b b')))
18+
(aset a 1 11)
19+
(is (= 11 (aget a 1)))
20+
(is (= 2 (aget a' 1)))
21+
(aset a' 2 12)
22+
(is (= 3 (aget a 2)))
23+
(is (= 12 (aget a' 2)))))
2224

23-
(deftest integer-arrays
24-
(clone-test (int-array 3) (int-array 0)))
25+
(deftest test-aclone
26+
(testing "integer-arrays"
27+
(clone-test (int-array 3) (int-array 0)))
2528

26-
(deftest object-arrays
27-
(clone-test (object-array 3) (object-array 0)))
29+
(testing "object-arrays"
30+
(clone-test (object-array 3) (object-array 0)))))

0 commit comments

Comments
 (0)