Skip to content

Commit 77b4b83

Browse files
authored
pop tests (#764)
* pop tests * pop tests
1 parent b47f9a9 commit 77b4b83

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/clojure/core_test/pop.cljc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
(ns clojure.core-test.pop
2+
(:require [clojure.test :as t :refer [deftest testing is are]]
3+
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
4+
5+
(when-var-exists pop
6+
(deftest test-pop
7+
(testing "common"
8+
(is (= nil (pop nil)))
9+
(is (= '(nil) (pop '(nil nil))))
10+
(is (= [1 2] (pop [1 2 3])))
11+
(is (= [1 2] (pop [1 2 (range)])))
12+
(is (= '(2 3) (pop '(1 2 3))))
13+
(is (= '(2 3) (pop '((range) 2 3))))
14+
#?@(:cljs [(is (thrown? js/Error (pop \space)))
15+
(is (thrown? js/Error (pop 0)))
16+
(is (thrown? js/Error (pop 0.0)))
17+
(is (thrown? js/Error (pop [])))
18+
(is (thrown? js/Error (pop '())))
19+
(is (thrown? js/Error (pop {})))]
20+
:default [(is (thrown? Exception (pop 0)))
21+
(is (thrown? Exception (pop 0.0)))
22+
(is (thrown? Exception (pop \space)))
23+
(is (thrown? Exception (pop [])))
24+
(is (thrown? Exception (pop '())))
25+
(is (thrown? Exception (pop {})))]))))

0 commit comments

Comments
 (0)