aboutsummaryrefslogtreecommitdiff
path: root/src/clojure/contrib/test_contrib
diff options
context:
space:
mode:
authorStuart Halloway <stu@thinkrelevance.com>2009-06-24 01:08:56 -0400
committerStuart Halloway <stu@thinkrelevance.com>2009-06-24 01:08:56 -0400
commit4f2c7bb5cf6828eb710fd18b603828ab295d0fa5 (patch)
tree3d211ff0dfa90421674814ae64265f9f551987dd /src/clojure/contrib/test_contrib
parent17e6a5c17a9f0577f749632b81e3900a383405c6 (diff)
gtic: move clojure tests and supporting libraries into clojure repos
Diffstat (limited to 'src/clojure/contrib/test_contrib')
-rw-r--r--src/clojure/contrib/test_contrib/complex_numbers.clj2
-rw-r--r--src/clojure/contrib/test_contrib/fnmap.clj2
-rw-r--r--src/clojure/contrib/test_contrib/greatest_least.clj2
-rw-r--r--src/clojure/contrib/test_contrib/macro_utils.clj2
-rw-r--r--src/clojure/contrib/test_contrib/monads.clj2
-rw-r--r--src/clojure/contrib/test_contrib/pprint/cl_format.clj2
-rw-r--r--src/clojure/contrib/test_contrib/pprint/helper.clj2
-rw-r--r--src/clojure/contrib/test_contrib/pprint/pretty.clj2
-rw-r--r--src/clojure/contrib/test_contrib/shell_out.clj2
-rw-r--r--src/clojure/contrib/test_contrib/str_utils.clj2
-rw-r--r--src/clojure/contrib/test_contrib/str_utils2.clj2
-rw-r--r--src/clojure/contrib/test_contrib/test_dataflow.clj2
-rw-r--r--src/clojure/contrib/test_contrib/test_graph.clj2
-rw-r--r--src/clojure/contrib/test_contrib/test_is.clj113
-rw-r--r--src/clojure/contrib/test_contrib/test_is_fixtures.clj42
-rw-r--r--src/clojure/contrib/test_contrib/test_java_utils.clj2
-rw-r--r--src/clojure/contrib/test_contrib/test_lazy_seqs.clj2
-rw-r--r--src/clojure/contrib/test_contrib/walk.clj2
18 files changed, 16 insertions, 171 deletions
diff --git a/src/clojure/contrib/test_contrib/complex_numbers.clj b/src/clojure/contrib/test_contrib/complex_numbers.clj
index 2ac2ff86..7498e897 100644
--- a/src/clojure/contrib/test_contrib/complex_numbers.clj
+++ b/src/clojure/contrib/test_contrib/complex_numbers.clj
@@ -13,7 +13,7 @@
(ns clojure.contrib.test-contrib.complex-numbers
(:refer-clojure :exclude [+ - * / = < > <= >=])
- (:use [clojure.contrib.test-is
+ (:use [clojure.test
:only (deftest is are run-tests)]
[clojure.contrib.generic.arithmetic
:only (+ - * /)]
diff --git a/src/clojure/contrib/test_contrib/fnmap.clj b/src/clojure/contrib/test_contrib/fnmap.clj
index 8d833360..7fe87cc3 100644
--- a/src/clojure/contrib/test_contrib/fnmap.clj
+++ b/src/clojure/contrib/test_contrib/fnmap.clj
@@ -1,6 +1,6 @@
(ns clojure.contrib.test-contrib.fnmap
(:use clojure.contrib.fnmap
- clojure.contrib.test-is))
+ clojure.test))
(deftest acts-like-map
(let [m1 (fnmap get assoc :key1 1 :key2 2)]
diff --git a/src/clojure/contrib/test_contrib/greatest_least.clj b/src/clojure/contrib/test_contrib/greatest_least.clj
index 557c0a3c..f273aaf2 100644
--- a/src/clojure/contrib/test_contrib/greatest_least.clj
+++ b/src/clojure/contrib/test_contrib/greatest_least.clj
@@ -1,6 +1,6 @@
(ns clojure.contrib.test-contrib.greatest-least
(:use clojure.contrib.greatest-least
- [clojure.contrib.test-is :only (is deftest run-tests)]))
+ [clojure.test :only (is deftest run-tests)]))
(deftest test-greatest
(is (nil? (greatest)) "greatest with no arguments is nil")
diff --git a/src/clojure/contrib/test_contrib/macro_utils.clj b/src/clojure/contrib/test_contrib/macro_utils.clj
index 01c64678..ac1ced06 100644
--- a/src/clojure/contrib/test_contrib/macro_utils.clj
+++ b/src/clojure/contrib/test_contrib/macro_utils.clj
@@ -12,7 +12,7 @@
;; remove this notice, or any other, from this software.
(ns clojure.contrib.test-contrib.macro-utils
- (:use [clojure.contrib.test-is :only (deftest is are run-tests use-fixtures)]
+ (:use [clojure.test :only (deftest is are run-tests use-fixtures)]
[clojure.contrib.macro-utils
:only (macrolet symbol-macrolet defsymbolmacro with-symbol-macros
mexpand-1 mexpand mexpand-all)]
diff --git a/src/clojure/contrib/test_contrib/monads.clj b/src/clojure/contrib/test_contrib/monads.clj
index a09d646d..f523f0ec 100644
--- a/src/clojure/contrib/test_contrib/monads.clj
+++ b/src/clojure/contrib/test_contrib/monads.clj
@@ -12,7 +12,7 @@
;; remove this notice, or any other, from this software.
(ns clojure.contrib.test-contrib.monads
- (:use [clojure.contrib.test-is :only (deftest is are run-tests)]
+ (:use [clojure.test :only (deftest is are run-tests)]
[clojure.contrib.monads
:only (with-monad domonad m-lift m-seq m-chain
sequence-m maybe-m state-m maybe-t sequence-t)]))
diff --git a/src/clojure/contrib/test_contrib/pprint/cl_format.clj b/src/clojure/contrib/test_contrib/pprint/cl_format.clj
index 3de10959..b101b92b 100644
--- a/src/clojure/contrib/test_contrib/pprint/cl_format.clj
+++ b/src/clojure/contrib/test_contrib/pprint/cl_format.clj
@@ -15,7 +15,7 @@
(ns clojure.contrib.test-contrib.pprint.cl-format
(:refer-clojure :exclude [format])
- (:use [clojure.contrib.test-is :only (deftest are run-tests)]
+ (:use [clojure.test :only (deftest are run-tests)]
clojure.contrib.test-contrib.pprint.helper
clojure.contrib.pprint))
diff --git a/src/clojure/contrib/test_contrib/pprint/helper.clj b/src/clojure/contrib/test_contrib/pprint/helper.clj
index 9a4005d6..bf25ca61 100644
--- a/src/clojure/contrib/test_contrib/pprint/helper.clj
+++ b/src/clojure/contrib/test_contrib/pprint/helper.clj
@@ -14,7 +14,7 @@
;; This is just a macro to make my tests a little cleaner
(ns clojure.contrib.test-contrib.pprint.helper
- (:use [clojure.contrib.test-is :only (deftest are run-tests)]))
+ (:use [clojure.test :only (deftest are run-tests)]))
(defmacro simple-tests [name & test-pairs]
`(deftest ~name (are [x y] (= x y) ~@test-pairs)))
diff --git a/src/clojure/contrib/test_contrib/pprint/pretty.clj b/src/clojure/contrib/test_contrib/pprint/pretty.clj
index c0cbb615..f51b172f 100644
--- a/src/clojure/contrib/test_contrib/pprint/pretty.clj
+++ b/src/clojure/contrib/test_contrib/pprint/pretty.clj
@@ -12,7 +12,7 @@
; You must not remove this notice, or any other, from this software.
(ns clojure.contrib.test-contrib.pprint.pretty
- (:use [clojure.contrib.test-is :only (deftest are run-tests)]
+ (:use [clojure.test :only (deftest are run-tests)]
clojure.contrib.test-contrib.pprint.helper
clojure.contrib.pprint))
diff --git a/src/clojure/contrib/test_contrib/shell_out.clj b/src/clojure/contrib/test_contrib/shell_out.clj
index b6cedabb..c5447099 100644
--- a/src/clojure/contrib/test_contrib/shell_out.clj
+++ b/src/clojure/contrib/test_contrib/shell_out.clj
@@ -1,5 +1,5 @@
(ns clojure.contrib.test-contrib.shell-out
- (:use clojure.contrib.test-is
+ (:use clojure.test
clojure.contrib.shell-out)
(:import (java.io File)))
diff --git a/src/clojure/contrib/test_contrib/str_utils.clj b/src/clojure/contrib/test_contrib/str_utils.clj
index 812821dc..815525bb 100644
--- a/src/clojure/contrib/test_contrib/str_utils.clj
+++ b/src/clojure/contrib/test_contrib/str_utils.clj
@@ -1,5 +1,5 @@
(ns clojure.contrib.test-contrib.str-utils
- (:use clojure.contrib.test-is
+ (:use clojure.test
clojure.contrib.str-utils))
diff --git a/src/clojure/contrib/test_contrib/str_utils2.clj b/src/clojure/contrib/test_contrib/str_utils2.clj
index d7d9b131..dac0893a 100644
--- a/src/clojure/contrib/test_contrib/str_utils2.clj
+++ b/src/clojure/contrib/test_contrib/str_utils2.clj
@@ -1,6 +1,6 @@
(ns clojure.contrib.test-contrib.str-utils2
(:require [clojure.contrib.str-utils2 :as s])
- (:use clojure.contrib.test-is))
+ (:use clojure.test))
(deftest t-blank
(is (s/blank? nil))
diff --git a/src/clojure/contrib/test_contrib/test_dataflow.clj b/src/clojure/contrib/test_contrib/test_dataflow.clj
index 9ad327eb..991e7f2e 100644
--- a/src/clojure/contrib/test_contrib/test_dataflow.clj
+++ b/src/clojure/contrib/test_contrib/test_dataflow.clj
@@ -15,7 +15,7 @@
(ns clojure.contrib.test-contrib.test-dataflow
- (:use clojure.contrib.test-is)
+ (:use clojure.test)
(:use clojure.contrib.dataflow))
(def df-1
diff --git a/src/clojure/contrib/test_contrib/test_graph.clj b/src/clojure/contrib/test_contrib/test_graph.clj
index 425966bf..ed03b9ae 100644
--- a/src/clojure/contrib/test_contrib/test_graph.clj
+++ b/src/clojure/contrib/test_contrib/test_graph.clj
@@ -14,7 +14,7 @@
;; Created 23 June 2009
(ns clojure.contrib.test-contrib.test-graph
- (use clojure.contrib.test-is
+ (use clojure.test
clojure.contrib.graph))
diff --git a/src/clojure/contrib/test_contrib/test_is.clj b/src/clojure/contrib/test_contrib/test_is.clj
deleted file mode 100644
index f9e77d76..00000000
--- a/src/clojure/contrib/test_contrib/test_is.clj
+++ /dev/null
@@ -1,113 +0,0 @@
-;;; test_contrib/test_is.clj: unit tests for test_is.clj
-
-;; by Stuart Sierra, http://stuartsierra.com/
-;; January 16, 2009
-
-;; Thanks to Chas Emerick, Allen Rohner, and Stuart Halloway for
-;; contributions and suggestions.
-
-;; Copyright (c) Stuart Sierra, 2008. All rights reserved. The use
-;; and distribution terms for this software are covered by the Eclipse
-;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-;; which can be found in the file epl-v10.html at the root of this
-;; distribution. By using this software in any fashion, you are
-;; agreeing to be bound by the terms of this license. You must not
-;; remove this notice, or any other, from this software.
-
-
-(ns clojure.contrib.test-contrib.test-is
- (:use clojure.contrib.test-is))
-
-(deftest can-test-symbol
- (let [x true]
- (is x "Should pass"))
- (let [x false]
- (is x "Should fail")))
-
-(deftest can-test-boolean
- (is true "Should pass")
- (is false "Should fail"))
-
-(deftest can-test-nil
- (is nil "Should fail"))
-
-(deftest can-test-=
- (is (= 2 (+ 1 1)) "Should pass")
- (is (= 3 (+ 2 2)) "Should fail"))
-
-(deftest can-test-instance
- (is (instance? Integer (+ 2 2)) "Should pass")
- (is (instance? Float (+ 1 1)) "Should fail"))
-
-(deftest can-test-thrown
- (is (thrown? ArithmeticException (/ 1 0)) "Should pass")
- ;; No exception is thrown:
- (is (thrown? Exception (+ 1 1)) "Should fail")
- ;; Wrong class of exception is thrown:
- (is (thrown? ArithmeticException (throw (RuntimeException.))) "Should error"))
-
-(deftest can-test-thrown-with-msg
- (is (thrown-with-msg? ArithmeticException #"Divide by zero" (/ 1 0)) "Should pass")
- ;; Wrong message string:
- (is (thrown-with-msg? ArithmeticException #"Something else" (/ 1 0)) "Should fail")
- ;; No exception is thrown:
- (is (thrown? Exception (+ 1 1)) "Should fail")
- ;; Wrong class of exception is thrown:
- (is (thrown-with-msg? IllegalArgumentException #"Divide by zero" (/ 1 0)) "Should error"))
-
-(deftest can-catch-unexpected-exceptions
- (is (= 1 (throw (Exception.))) "Should error"))
-
-(deftest can-test-method-call
- (is (.startsWith "abc" "a") "Should pass")
- (is (.startsWith "abc" "d") "Should fail"))
-
-(deftest can-test-anonymous-fn
- (is (#(.startsWith % "a") "abc") "Should pass")
- (is (#(.startsWith % "d") "abc") "Should fail"))
-
-(deftest can-test-regexps
- (is (re-matches #"^ab.*$" "abbabba") "Should pass")
- (is (re-matches #"^cd.*$" "abbabba") "Should fail")
- (is (re-find #"ab" "abbabba") "Should pass")
- (is (re-find #"cd" "abbabba") "Should fail"))
-
-
-;; still have to declare the symbol before testing unbound symbols
-(declare does-not-exist)
-
-(deftest can-test-unbound-symbol
- (is (= nil does-not-exist) "Should error"))
-
-(deftest can-test-unbound-function
- (is (does-not-exist) "Should error"))
-
-
-;; Here, we create an alternate version of test-is/report, that
-;; compares the event with the message, then calls the original
-;; 'report' with modified arguments.
-
-(declare original-report)
-
-(defn custom-report [data]
- (let [event (:type data)
- msg (:message data)
- expected (:expected data)
- actual (:actual data)
- passed (cond
- (= event :fail) (= msg "Should fail")
- (= event :pass) (= msg "Should pass")
- (= event :error) (= msg "Should error")
- :else true)]
- (if passed
- (original-report {:type :pass, :message msg,
- :expected expected, :actual actual})
- (original-report {:type :fail, :message (str msg " but got " event)
- :expected expected, :actual actual}))))
-
-;; test-ns-hook will be used by test-is/test-ns to run tests in this
-;; namespace.
-(defn test-ns-hook []
- (binding [original-report report
- report custom-report]
- (test-all-vars (find-ns 'clojure.contrib.test-contrib.test-is))))
diff --git a/src/clojure/contrib/test_contrib/test_is_fixtures.clj b/src/clojure/contrib/test_contrib/test_is_fixtures.clj
deleted file mode 100644
index 218c45d5..00000000
--- a/src/clojure/contrib/test_contrib/test_is_fixtures.clj
+++ /dev/null
@@ -1,42 +0,0 @@
-;;; test_is_fixtures.clj: unit tests for fixtures in test_is.clj
-
-;; by Stuart Sierra, http://stuartsierra.com/
-;; March 28, 2009
-
-;; Copyright (c) Stuart Sierra, 2009. All rights reserved. The use
-;; and distribution terms for this software are covered by the Eclipse
-;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-;; which can be found in the file epl-v10.html at the root of this
-;; distribution. By using this software in any fashion, you are
-;; agreeing to be bound by the terms of this license. You must not
-;; remove this notice, or any other, from this software.
-
-
-(ns clojure.contrib.test-contrib.test-is-fixtures
- (:use clojure.contrib.test-is))
-
-(declare *a* *b* *c* *d*)
-
-(defn fixture-a [f]
- (binding [*a* 3] (f)))
-
-(defn fixture-b [f]
- (binding [*b* 5] (f)))
-
-(defn fixture-c [f]
- (binding [*c* 7] (f)))
-
-(defn fixture-d [f]
- (binding [*d* 11] (f)))
-
-(use-fixtures :once fixture-a fixture-b)
-
-(use-fixtures :each fixture-c fixture-d)
-
-(deftest can-use-once-fixtures
- (is (= 3 *a*))
- (is (= 5 *b*)))
-
-(deftest can-use-each-fixtures
- (is (= 7 *c*))
- (is (= 11 *d*)))
diff --git a/src/clojure/contrib/test_contrib/test_java_utils.clj b/src/clojure/contrib/test_contrib/test_java_utils.clj
index 409f07b2..8a56b197 100644
--- a/src/clojure/contrib/test_contrib/test_java_utils.clj
+++ b/src/clojure/contrib/test_contrib/test_java_utils.clj
@@ -1,5 +1,5 @@
(ns clojure.contrib.test-contrib.test-java-utils
- (:use clojure.contrib.test-is
+ (:use clojure.test
[clojure.contrib.duck-streams :only (spit)]
clojure.contrib.java-utils)
(:import [java.io File]
diff --git a/src/clojure/contrib/test_contrib/test_lazy_seqs.clj b/src/clojure/contrib/test_contrib/test_lazy_seqs.clj
index 3bf4ba78..33bbcae1 100644
--- a/src/clojure/contrib/test_contrib/test_lazy_seqs.clj
+++ b/src/clojure/contrib/test_contrib/test_lazy_seqs.clj
@@ -1,5 +1,5 @@
(ns clojure.contrib.test-contrib.test-lazy-seqs
- (:use clojure.contrib.test-is
+ (:use clojure.test
clojure.contrib.lazy-seqs))
(deftest test-fibs
diff --git a/src/clojure/contrib/test_contrib/walk.clj b/src/clojure/contrib/test_contrib/walk.clj
index 2fb36d4e..9e79f8d6 100644
--- a/src/clojure/contrib/test_contrib/walk.clj
+++ b/src/clojure/contrib/test_contrib/walk.clj
@@ -1,6 +1,6 @@
(ns clojure.contrib.test-contrib.walk
(:require [clojure.contrib.walk :as w])
- (:use clojure.contrib.test-is))
+ (:use clojure.test))
(deftest t-prewalk-replace
(is (= (w/prewalk-replace {:a :b} [:a {:a :a} (list 3 :c :a)])