aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/clojure/clojure/contrib/test_jmx.clj12
-rw-r--r--src/test/clojure/clojure/contrib/test_repl_utils.clj13
-rw-r--r--src/test/clojure/clojure/contrib/test_seq.clj53
-rw-r--r--src/test/clojure/clojure/contrib/test_with_ns.clj7
4 files changed, 15 insertions, 70 deletions
diff --git a/src/test/clojure/clojure/contrib/test_jmx.clj b/src/test/clojure/clojure/contrib/test_jmx.clj
index 17ba1e55..ef7037b0 100644
--- a/src/test/clojure/clojure/contrib/test_jmx.clj
+++ b/src/test/clojure/clojure/contrib/test_jmx.clj
@@ -15,18 +15,18 @@
[javax.management MBeanAttributeInfo AttributeList]
[java.util.logging LogManager Logger]
clojure.contrib.jmx.Bean)
- (:use clojure.test [clojure.contrib.seq :only (includes?)])
+ (:use clojure.test)
(:require [clojure.contrib [jmx :as jmx]]))
(defn =set [a b]
(= (set a) (set b)))
-(defn includes-all?
+(defn seq-contains-all?
"Does container contain every item in containee?
Not fast. Testing use only"
[container containee]
- (every? #(includes? container %) containee))
+ (every? #(seq-contains? container %) containee))
(deftest finding-mbeans
(testing "as-object-name"
@@ -43,14 +43,14 @@
(deftest testing-actual-beans
(testing "reflecting on capabilities"
(are [attr-list mbean-name]
- (includes-all? (jmx/attribute-names mbean-name) attr-list)
+ (seq-contains-all? (jmx/attribute-names mbean-name) attr-list)
[:Verbose :ObjectPendingFinalizationCount :HeapMemoryUsage :NonHeapMemoryUsage] "java.lang:type=Memory")
(are [op-list mbean-name]
- (includes-all? (jmx/operation-names mbean-name) op-list)
+ (seq-contains-all? (jmx/operation-names mbean-name) op-list)
[:gc] "java.lang:type=Memory"))
(testing "mbean-from-oname"
(are [key-names oname]
- (includes-all? (keys (jmx/mbean oname)) key-names)
+ (seq-contains-all? (keys (jmx/mbean oname)) key-names)
[:Verbose :ObjectPendingFinalizationCount :HeapMemoryUsage :NonHeapMemoryUsage] "java.lang:type=Memory")))
(deftest raw-reading-attributes
diff --git a/src/test/clojure/clojure/contrib/test_repl_utils.clj b/src/test/clojure/clojure/contrib/test_repl_utils.clj
index ac8376e8..77ae2aae 100644
--- a/src/test/clojure/clojure/contrib/test_repl_utils.clj
+++ b/src/test/clojure/clojure/contrib/test_repl_utils.clj
@@ -1,21 +1,20 @@
(ns clojure.contrib.test-repl-utils
(:use clojure.test
- clojure.contrib.repl-utils
- [clojure.contrib.seq :only (includes?)]))
+ clojure.contrib.repl-utils))
(deftest test-apropos
(testing "with a regular expression"
(is (= '[defmacro] (apropos #"^defmacro$")))
- (is (includes? (apropos #"def.acr.") 'defmacro))
+ (is (seq-contains? (apropos #"def.acr.") 'defmacro))
(is (= [] (apropos #"nothing-has-this-name"))))
(testing "with a string"
- (is (includes? (apropos "defmacro") 'defmacro))
- (is (includes? (apropos "efmac") 'defmacro))
+ (is (seq-contains? (apropos "defmacro") 'defmacro))
+ (is (seq-contains? (apropos "efmac") 'defmacro))
(is (= [] (apropos "nothing-has-this-name"))))
(testing "with a symbol"
- (is (includes? (apropos 'defmacro) 'defmacro))
- (is (includes? (apropos 'efmac) 'defmacro))
+ (is (seq-contains? (apropos 'defmacro) 'defmacro))
+ (is (seq-contains? (apropos 'efmac) 'defmacro))
(is (= [] (apropos 'nothing-has-this-name)))))
diff --git a/src/test/clojure/clojure/contrib/test_seq.clj b/src/test/clojure/clojure/contrib/test_seq.clj
index fafb4b05..144f7ced 100644
--- a/src/test/clojure/clojure/contrib/test_seq.clj
+++ b/src/test/clojure/clojure/contrib/test_seq.clj
@@ -53,10 +53,6 @@
#{1 2 3 4 5}
'(1 2 3 4 5)))
-(deftest test-includes?
- (is (includes? [1 2 3 4 5] 5))
- (is (not (includes? [1 2 3 4 5] 6))))
-
;Note - this does not make sense for maps and sets, because order is expected
(deftest test-indexed
(are [expected test-seq] (= (indexed test-seq) expected)
@@ -64,33 +60,6 @@
[[0 :a] [1 :b] [2 :c] [3 :d]] '(:a :b :c :d)
[[0 \1] [1 \2] [2 \3] [3 \4]] "1234"))
-(deftest test-group-by
- (is (= (group-by even? [1 2 3 4 5])
- {false [1 3 5], true [2 4]})))
-
-;Note - this does not make sense for maps and sets, because order is expected
-(deftest test-partition-by
- (are [test-seq] (= (partition-by (comp even? count) test-seq)
- [["a"] ["bb" "cccc" "dd"] ["eee" "f"] ["" "hh"]])
- ["a" "bb" "cccc" "dd" "eee" "f" "" "hh"]
- '("a" "bb" "cccc" "dd" "eee" "f" "" "hh"))
- (is (=(partition-by #{\a \e \i \o \u} "abcdefghijklm")
- [[\a] [\b \c \d] [\e] [\f \g \h] [\i] [\j \k \l \m]])))
-
-(deftest test-frequencies
- (are [expected test-seq] (= (frequencies test-seq) expected)
- {\p 2, \s 4, \i 4, \m 1} "mississippi"
- {1 4 2 2 3 1} [1 1 1 1 2 2 3]
- {1 4 2 2 3 1} '(1 1 1 1 2 2 3)))
-
-;Note - this does not make sense for maps and sets, because order is expected
-;This is a key differnce between reductions and reduce.
-(deftest test-reductions
- (is (= (reductions + [1 2 3 4 5])
- [1 3 6 10 15]))
- (is (= (reductions + 10 [1 2 3 4 5])
- [10 11 13 16 20 25])))
-
;Note - this does not make sense for maps and sets, because order is expected
(deftest test-rotations
(is (= (rotations [1 2 3 4])
@@ -100,28 +69,6 @@
[4 1 2 3]])))
;Note - this does not make sense for maps and sets, because order is expected
-(deftest test-partition-all
- (is (= (partition-all 4 [1 2 3 4 5 6 7 8 9])
- [[1 2 3 4] [5 6 7 8] [9]]))
- (is (= (partition-all 4 2 [1 2 3 4 5 6 7 8 9])
- [[1 2 3 4] [3 4 5 6] [5 6 7 8] [7 8 9] [9]])))
-
-;Thanks to Andy Fingerhut for the idea of testing invariants
-(deftest test-shuffle-invariants
- (is (= (count (shuffle [1 2 3 4])) 4))
- (let [shuffled-seq (shuffle [1 2 3 4])]
- (is (every? #{1 2 3 4} shuffled-seq))))
-
-(deftest test-shuffle-distributions
- (let [a-statistician-needed-to-do-this? true]
- (is a-statistician-needed-to-do-this?)))
-
-;Thanks to Andy Fingerhut for the idea of testing invariants
-(deftest test-rand-elt-invariants
- (let [elt (rand-elt [:a :b :c :d])]
- (is (#{:a :b :c :d} elt))))
-
-;Note - this does not make sense for maps and sets, because order is expected
(deftest test-find-first
(is (= (find-first even? [1 2 3 4 5]) 2))
(is (= (find-first even? '(1 2 3 4 5)) 2)))
diff --git a/src/test/clojure/clojure/contrib/test_with_ns.clj b/src/test/clojure/clojure/contrib/test_with_ns.clj
index 14ab5570..5ba62c0e 100644
--- a/src/test/clojure/clojure/contrib/test_with_ns.clj
+++ b/src/test/clojure/clojure/contrib/test_with_ns.clj
@@ -1,13 +1,12 @@
(ns clojure.contrib.test-with-ns
(:use clojure.test
- clojure.contrib.with-ns
- [clojure.contrib.seq :only (includes?)]))
+ clojure.contrib.with-ns))
(deftest test-namespace-gets-removed
(let [all-ns-names (fn [] (map #(.name %) (all-ns)))]
(testing "unexceptional return"
(let [ns-name (with-temp-ns (ns-name *ns*))]
- (is (not (includes? (all-ns-names) ns-name)))))
+ (is (not (seq-contains? (all-ns-names) ns-name)))))
(testing "when an exception is thrown"
(let [ns-name-str
(try
@@ -16,4 +15,4 @@
(catch clojure.lang.Compiler$CompilerException e
(-> e .getCause .getMessage)))]
(is (re-find #"^sym.*$" ns-name-str))
- (is (not (includes? (all-ns-names) (symbol ns-name-str))))))))
+ (is (not (seq-contains? (all-ns-names) (symbol ns-name-str))))))))