Skip to content

Commit 967ea84

Browse files
authored
Merge pull request #44 from dgr/dgr-coarsen-exceptions
Coarsen exceptions
2 parents 0658caf + 67878b2 commit 967ea84

26 files changed

+115
-108
lines changed

test/clojure/core_test/abs.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
:default
2020
[-1/5 1/5]))
2121
(is (NaN? (abs ##NaN)))
22-
(is (thrown? #?(:cljs :default :clj NullPointerException) (abs nil))))
22+
(is (thrown? #?(:cljs :default :clj Exception) (abs nil))))
2323

2424
(testing "unboxed"
2525
(let [a 42

test/clojure/core_test/bit_and.cljc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
(when-var-exists clojure.core/bit-and
77
(deftest test-bit-and
8-
#?(:clj (is (thrown? NullPointerException (bit-and nil 1)))
9-
:cljs (is (bit-and nil 1)))
10-
#?(:clj (is (thrown? NullPointerException (bit-and 1 nil)))
11-
:cljs (is (bit-and 1 nil)))
8+
#?(:clj (is (thrown? Exception (bit-and nil 1)))
9+
:cljs (is (= 0 (bit-and nil 1))))
10+
#?(:clj (is (thrown? Exception (bit-and 1 nil)))
11+
:cljs (is (= 0 (bit-and 1 nil))))
1212

1313
(are [ex a b] (= ex (bit-and a b))
1414
8 12 9

test/clojure/core_test/bit_and_not.cljc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
(when-var-exists clojure.core/bit-and-not
77
(deftest test-bit-and-not
8-
#?(:clj (is (thrown? NullPointerException (bit-and-not nil 1)))
9-
:cljs (is (bit-and-not nil 1)))
10-
#?(:clj (is (thrown? NullPointerException (bit-and-not 1 nil)))
11-
:cljs (is (bit-and-not 1 nil)))
8+
#?(:clj (is (thrown? Exception (bit-and-not nil 1)))
9+
:cljs (is (= 0 (bit-and-not nil 1))))
10+
#?(:clj (is (thrown? Exception (bit-and-not 1 nil)))
11+
:cljs (is (= 1 (bit-and-not 1 nil))))
1212

1313
(are [ex a b] (= ex (bit-and-not a b))
1414
0 0 0

test/clojure/core_test/bit_clear.cljc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
(when-var-exists clojure.core/bit-clear
66
(deftest test-bit-clear
7-
#?(:clj (is (thrown? NullPointerException (bit-clear nil 1)))
8-
:cljs (is (bit-clear nil 1)))
9-
#?(:clj (is (thrown? NullPointerException (bit-clear 1 nil)))
10-
:cljs (is (bit-clear 1 nil)))
7+
#?(:clj (is (thrown? Exception (bit-clear nil 1)))
8+
:cljs (is (= 0 (bit-clear nil 1))))
9+
#?(:clj (is (thrown? Exception (bit-clear 1 nil)))
10+
:cljs (is (= 0 (bit-clear 1 nil))))
1111

1212
(are [ex a b] (= ex (bit-clear a b))
1313
3 11 3)))

test/clojure/core_test/bit_flip.cljc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
(when-var-exists clojure.core/bit-flip
66
(deftest test-bit-flip
7-
#?(:clj (is (thrown? NullPointerException (bit-flip nil 1)))
8-
:cljs (is (bit-flip nil 1)))
9-
#?(:clj (is (thrown? NullPointerException (bit-flip 1 nil)))
10-
:cljs (is (bit-flip 1 nil)))
7+
#?(:clj (is (thrown? Exception (bit-flip nil 1)))
8+
:cljs (is (= 2 (bit-flip nil 1))))
9+
#?(:clj (is (thrown? Exception (bit-flip 1 nil)))
10+
:cljs (is (= 0 (bit-flip 1 nil))))
1111

1212
(are [ex a b] (= ex (bit-flip a b))
1313
2r1111 2r1011 2

test/clojure/core_test/bit_not.cljc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
(when-var-exists clojure.core/bit-not
66
(deftest test-bit-not
7-
#?(:clj (is (thrown? NullPointerException (bit-not nil)))
8-
:cljs (is (bit-not nil)))
7+
#?(:clj (is (thrown? Exception (bit-not nil)))
8+
:cljs (is (= -1 (bit-not nil))))
99

1010
(are [ex a] (= ex (bit-not a))
1111
-2r1000 2r0111

test/clojure/core_test/bit_or.cljc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
(when-var-exists clojure.core/bit-or
77
(deftest test-bit-or
8-
#?(:clj (is (thrown? NullPointerException (bit-or nil 1)))
8+
#?(:clj (is (thrown? Exception (bit-or nil 1)))
99
:cljs (is (bit-or nil 1)))
10-
#?(:clj (is (thrown? NullPointerException (bit-or 1 nil)))
10+
#?(:clj (is (thrown? Exception (bit-or 1 nil)))
1111
:cljs (is (bit-or 1 nil)))
1212

1313
(are [ex a b] (= ex (bit-or a b))

test/clojure/core_test/bit_set.cljc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
(when-var-exists clojure.core/bit-set
66
(deftest test-bit-set
7-
#?(:clj (is (thrown? NullPointerException (bit-set nil 1)))
7+
#?(:clj (is (thrown? Exception (bit-set nil 1)))
88
:cljs (is (bit-set nil 1)))
9-
#?(:clj (is (thrown? NullPointerException (bit-set 1 nil)))
9+
#?(:clj (is (thrown? Exception (bit-set 1 nil)))
1010
:cljs (is (bit-set 1 nil)))
1111

1212
(are [ex a b] (= ex (bit-set a b))

test/clojure/core_test/bit_shift_left.cljc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
(when-var-exists clojure.core/bit-shift-left
66
(deftest test-bit-shift-left
7-
#?(:clj (is (thrown? NullPointerException (bit-shift-left nil 1)))
8-
:cljs (is (bit-shift-left nil 1)))
9-
#?(:clj (is (thrown? NullPointerException (bit-shift-left 1 nil)))
10-
:cljs (is (bit-shift-left 1 nil)))
7+
#?(:clj (is (thrown? Exception (bit-shift-left nil 1)))
8+
:cljs (is (= 0 (bit-shift-left nil 1))))
9+
#?(:clj (is (thrown? Exception (bit-shift-left 1 nil)))
10+
:cljs (is (= 1 (bit-shift-left 1 nil))))
1111

1212
(are [ex a b] (= ex (bit-shift-left a b))
1313
1024 1 10

test/clojure/core_test/bit_shift_right.cljc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
(when-var-exists clojure.core/bit-shift-right
66
(deftest test-bit-shift-right
7-
#?(:clj (is (thrown? NullPointerException (bit-shift-right nil 1)))
7+
#?(:clj (is (thrown? Exception (bit-shift-right nil 1)))
88
:cljs (is (bit-shift-right nil 1)))
9-
#?(:clj (is (thrown? NullPointerException (bit-shift-right 1 nil)))
9+
#?(:clj (is (thrown? Exception (bit-shift-right 1 nil)))
1010
:cljs (is (bit-shift-right 1 nil)))
1111

1212
(are [ex a b] (= ex (bit-shift-right a b))

0 commit comments

Comments
 (0)