diff options
author | Stuart Sierra <mail@stuartsierra.com> | 2010-02-01 12:17:51 -0500 |
---|---|---|
committer | Stuart Sierra <mail@stuartsierra.com> | 2010-02-01 12:42:48 -0500 |
commit | 4e62c17070e96d5801894a844a585fd10e56e3cc (patch) | |
tree | 23553170a7f8e8834defb874b093c7561a141ee3 | |
parent | 69ccca42d2b09c93e1b8de427a98cc52c4ce705a (diff) |
Rename namespace declarations in test sources.
25 files changed, 146 insertions, 156 deletions
diff --git a/src/test/clojure/clojure/contrib/pprint/test_cl_format.clj b/src/test/clojure/clojure/contrib/pprint/test_cl_format.clj index 6c73e63f..1bd48fb7 100644 --- a/src/test/clojure/clojure/contrib/pprint/test_cl_format.clj +++ b/src/test/clojure/clojure/contrib/pprint/test_cl_format.clj @@ -13,7 +13,7 @@ ;; This test set tests the basic cl-format functionality -(ns clojure.contrib.test-contrib.pprint.cl-format +(ns clojure.contrib.pprint.test-cl-format (:refer-clojure :exclude [format]) (:use [clojure.test :only (deftest are run-tests)] clojure.contrib.test-contrib.pprint.helper diff --git a/src/test/clojure/clojure/contrib/pprint/test_helper.clj b/src/test/clojure/clojure/contrib/pprint/test_helper.clj index bf25ca61..d4b97276 100644 --- a/src/test/clojure/clojure/contrib/pprint/test_helper.clj +++ b/src/test/clojure/clojure/contrib/pprint/test_helper.clj @@ -13,7 +13,7 @@ ;; This is just a macro to make my tests a little cleaner -(ns clojure.contrib.test-contrib.pprint.helper +(ns clojure.contrib.contrib.pprint.test-helper (:use [clojure.test :only (deftest are run-tests)])) (defmacro simple-tests [name & test-pairs] diff --git a/src/test/clojure/clojure/contrib/pprint/test_pretty.clj b/src/test/clojure/clojure/contrib/pprint/test_pretty.clj index 01e7c87e..dfc214ad 100644 --- a/src/test/clojure/clojure/contrib/pprint/test_pretty.clj +++ b/src/test/clojure/clojure/contrib/pprint/test_pretty.clj @@ -11,7 +11,7 @@ ; the terms of this license. ; You must not remove this notice, or any other, from this software. -(ns clojure.contrib.test-contrib.pprint.pretty +(ns clojure.contrib.pprint.test-pretty (:use [clojure.test :only (deftest are run-tests)] clojure.contrib.test-contrib.pprint.helper clojure.contrib.pprint)) diff --git a/src/test/clojure/clojure/contrib/test_complex_numbers.clj b/src/test/clojure/clojure/contrib/test_complex_numbers.clj index 7498e897..4b0173fe 100644 --- a/src/test/clojure/clojure/contrib/test_complex_numbers.clj +++ b/src/test/clojure/clojure/contrib/test_complex_numbers.clj @@ -11,7 +11,7 @@ ;; 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.complex-numbers +(ns clojure.contrib.test-complex-numbers (:refer-clojure :exclude [+ - * / = < > <= >=]) (:use [clojure.test :only (deftest is are run-tests)] diff --git a/src/test/clojure/clojure/contrib/test_core.clj b/src/test/clojure/clojure/contrib/test_core.clj index d2e0d50d..a27d63ee 100644 --- a/src/test/clojure/clojure/contrib/test_core.clj +++ b/src/test/clojure/clojure/contrib/test_core.clj @@ -12,7 +12,7 @@ ;; note to other contrib members: feel free to add to this lib -(ns clojure.contrib.core.tests +(ns clojure.contrib.test-core (:use clojure.test) (:use clojure.contrib.core)) diff --git a/src/test/clojure/clojure/contrib/test_dataflow.clj b/src/test/clojure/clojure/contrib/test_dataflow.clj index 8b934dc3..55e9592b 100644 --- a/src/test/clojure/clojure/contrib/test_dataflow.clj +++ b/src/test/clojure/clojure/contrib/test_dataflow.clj @@ -14,7 +14,7 @@ ;; Created 11 March 2009 -(ns clojure.contrib.test-contrib.test-dataflow +(ns clojure.contrib.test-dataflow (:use clojure.test) (:use clojure.contrib.dataflow)) diff --git a/src/test/clojure/clojure/contrib/test_fnmap.clj b/src/test/clojure/clojure/contrib/test_fnmap.clj index 7fe87cc3..04edc1e7 100644 --- a/src/test/clojure/clojure/contrib/test_fnmap.clj +++ b/src/test/clojure/clojure/contrib/test_fnmap.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.test-contrib.fnmap +(ns clojure.contrib.test-fnmap (:use clojure.contrib.fnmap clojure.test)) diff --git a/src/test/clojure/clojure/contrib/test_graph.clj b/src/test/clojure/clojure/contrib/test_graph.clj index ed03b9ae..c27df8bf 100644 --- a/src/test/clojure/clojure/contrib/test_graph.clj +++ b/src/test/clojure/clojure/contrib/test_graph.clj @@ -13,7 +13,7 @@ ;; straszheimjeffrey (gmail) ;; Created 23 June 2009 -(ns clojure.contrib.test-contrib.test-graph +(ns clojure.contrib.test-graph (use clojure.test clojure.contrib.graph)) diff --git a/src/test/clojure/clojure/contrib/test_greatest_least.clj b/src/test/clojure/clojure/contrib/test_greatest_least.clj index f273aaf2..20cda34d 100644 --- a/src/test/clojure/clojure/contrib/test_greatest_least.clj +++ b/src/test/clojure/clojure/contrib/test_greatest_least.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.test-contrib.greatest-least +(ns clojure.contrib.test-greatest-least (:use clojure.contrib.greatest-least [clojure.test :only (is deftest run-tests)])) diff --git a/src/test/clojure/clojure/contrib/test_java.clj b/src/test/clojure/clojure/contrib/test_java.clj index 2d74343a..9aab2c64 100644 --- a/src/test/clojure/clojure/contrib/test_java.clj +++ b/src/test/clojure/clojure/contrib/test_java.clj @@ -1,10 +1,123 @@ -(ns clojure.contrib.test-contrib.java - (:use clojure.test clojure.contrib.java)) - -(deftest t-as-str - (is (= "foo" (as-str "foo"))) - (is (= "foo" (as-str 'foo))) - (is (= "foo" (as-str :foo))) - (is (= "[1 2 3]" (as-str [1 2 3]))) - (is (= "Hello, World!" (as-str "Hello, " :World \!))) - (is (= (str {:foo :bar}) (as-str {:foo :bar})))) +(ns clojure.contrib.test-java + (:use clojure.test + [clojure.contrib.io :only (spit)] + clojure.contrib.java) + (:import [java.io File] + [java.net URL URI] + [java.util Properties])) + +(deftest test-relative-path-string + (testing "strings" + (is (= "foo" (relative-path-string "foo")))) + (testing "absolute path strings are forbidden" + (is (thrown? IllegalArgumentException (relative-path-string "/baz")))) + (testing "relative File paths" + (is (= "bar" (relative-path-string (File. "bar"))))) + (testing "absolute File paths are forbidden" + (is (thrown? IllegalArgumentException (relative-path-string (File. "/quux"))))) +) + +(deftest test-as-file + (testing "strings" + (is (= (File. "foo") (as-file "foo")))) + (testing "Files" + (is (= (File. "bar") (as-file (File. "bar"))))) +) + +(deftest test-as-url + (are [result expr] (= result expr) + (URL. "http://foo") (as-url (URL. "http://foo")) + (URL. "http://foo") (as-url "http://foo") + (URL. "http://foo") (as-url (URI. "http://foo")) + (URL. "file:/foo") (as-url (File. "/foo")))) + +(deftest test-file + (testing "single argument" + (is (= (File. "foo") (file "foo")))) + (testing "two arguments" + (is (= (File. "foo/bar") (file "foo" "bar")))) + (testing "N arguments" + (is (= (File. "foo/bar/baz/quux") (file "foo" "bar" "baz" "quux")))) + (testing "no sneaking in absolute paths!" + (is (thrown? IllegalArgumentException (file "foo" "bar" "/boom" "baz" "quux")))) +) + +(deftest test-as-str + (testing "keyword to string" + (is (= "foo") (as-str :foo))) + (testing "symbol to string" + (is (= "foo") (as-str 'foo))) + (testing "string to string" + (is (= "foo") (as-str "foo"))) + (testing "stringifying non-namish things" + (is (= "42") (as-str 42))) +) + +(deftest test-get-system-property + (testing "works the same with keywords, symbols, and strings" + (is (= (get-system-property "java.home") (get-system-property 'java.home))) + (is (= (get-system-property "java.home") (get-system-property :java.home)))) + (testing "treats second arg as default" + (is (= "default" (get-system-property "testing.test-system-property" "default")))) + (testing "returns nil for missing properties" + (is (nil? (get-system-property "testing.test-system-property")))) +) + +(deftest test-set-system-properties + (testing "set and then unset a property using keywords" + (let [propname :clojure.contrib.java.test-set-system-properties] + (is (nil? (get-system-property propname))) + (set-system-properties {propname :foo}) + (is (= "foo") (get-system-property propname)) + (set-system-properties {propname nil}) + (is (nil? (get-system-property propname))))) +) + +(deftest test-with-system-properties + (let [propname :clojure.contrib.java.test-with-system-properties] + (testing "sets a property only for the duration of a block" + (is (= "foo" + (with-system-properties {propname "foo"} + (get-system-property propname)))) + (is (nil? (get-system-property propname))))) + (testing "leaves other properties alone" + ; TODO: write this test better, using a properties -> map function + (let [propname :clojure.contrib.java.test-with-system-properties + propcount (count (System/getProperties))] + (with-system-properties {propname "foo"} + (is (= (inc propcount) (count (System/getProperties))))) + (is (= propcount (count (System/getProperties)))))) +) + +(deftest test-as-properties + (let [expected (doto (Properties.) + (.setProperty "a" "b") + (.setProperty "c" "d"))] + (testing "with a map" + (is (= expected + (as-properties {:a "b" :c "d"})))) + (testing "with a sequence of pairs" + (is (= expected + (as-properties [[:a :b] [:c :d]])))))) + +(deftest test-read-properties + (let [f (File/createTempFile "test" "properties")] + (spit f "a=b\nc=d") + (is (= {"a" "b" "c" "d"} + (read-properties f))))) + +(deftest test-write-properties + (let [f (File/createTempFile "test" "properties")] + (write-properties [['a 'b] ['c 'd]] f) + (is (= {"a" "b" "c" "d"} + (read-properties f))))) + + +(deftest test-delete-file + (let [file (File/createTempFile "test" "deletion") + not-file (File. (str (java.util.UUID/randomUUID)))] + (delete-file (.getAbsolutePath file)) + (is (not (.exists file))) + (is (thrown? ArithmeticException (/ 1 0))) + (is (thrown? java.io.IOException (delete-file not-file))) + (is (delete-file not-file :silently)))) diff --git a/src/test/clojure/clojure/contrib/test_java_utils.clj b/src/test/clojure/clojure/contrib/test_java_utils.clj deleted file mode 100644 index 7ccc5154..00000000 --- a/src/test/clojure/clojure/contrib/test_java_utils.clj +++ /dev/null @@ -1,123 +0,0 @@ -(ns clojure.contrib.test-contrib.test-java - (:use clojure.test - [clojure.contrib.io :only (spit)] - clojure.contrib.java) - (:import [java.io File] - [java.net URL URI] - [java.util Properties])) - -(deftest test-relative-path-string - (testing "strings" - (is (= "foo" (relative-path-string "foo")))) - (testing "absolute path strings are forbidden" - (is (thrown? IllegalArgumentException (relative-path-string "/baz")))) - (testing "relative File paths" - (is (= "bar" (relative-path-string (File. "bar"))))) - (testing "absolute File paths are forbidden" - (is (thrown? IllegalArgumentException (relative-path-string (File. "/quux"))))) -) - -(deftest test-as-file - (testing "strings" - (is (= (File. "foo") (as-file "foo")))) - (testing "Files" - (is (= (File. "bar") (as-file (File. "bar"))))) -) - -(deftest test-as-url - (are [result expr] (= result expr) - (URL. "http://foo") (as-url (URL. "http://foo")) - (URL. "http://foo") (as-url "http://foo") - (URL. "http://foo") (as-url (URI. "http://foo")) - (URL. "file:/foo") (as-url (File. "/foo")))) - -(deftest test-file - (testing "single argument" - (is (= (File. "foo") (file "foo")))) - (testing "two arguments" - (is (= (File. "foo/bar") (file "foo" "bar")))) - (testing "N arguments" - (is (= (File. "foo/bar/baz/quux") (file "foo" "bar" "baz" "quux")))) - (testing "no sneaking in absolute paths!" - (is (thrown? IllegalArgumentException (file "foo" "bar" "/boom" "baz" "quux")))) -) - -(deftest test-as-str - (testing "keyword to string" - (is (= "foo") (as-str :foo))) - (testing "symbol to string" - (is (= "foo") (as-str 'foo))) - (testing "string to string" - (is (= "foo") (as-str "foo"))) - (testing "stringifying non-namish things" - (is (= "42") (as-str 42))) -) - -(deftest test-get-system-property - (testing "works the same with keywords, symbols, and strings" - (is (= (get-system-property "java.home") (get-system-property 'java.home))) - (is (= (get-system-property "java.home") (get-system-property :java.home)))) - (testing "treats second arg as default" - (is (= "default" (get-system-property "testing.test-system-property" "default")))) - (testing "returns nil for missing properties" - (is (nil? (get-system-property "testing.test-system-property")))) -) - -(deftest test-set-system-properties - (testing "set and then unset a property using keywords" - (let [propname :clojure.contrib.java.test-set-system-properties] - (is (nil? (get-system-property propname))) - (set-system-properties {propname :foo}) - (is (= "foo") (get-system-property propname)) - (set-system-properties {propname nil}) - (is (nil? (get-system-property propname))))) -) - -(deftest test-with-system-properties - (let [propname :clojure.contrib.java.test-with-system-properties] - (testing "sets a property only for the duration of a block" - (is (= "foo" - (with-system-properties {propname "foo"} - (get-system-property propname)))) - (is (nil? (get-system-property propname))))) - (testing "leaves other properties alone" - ; TODO: write this test better, using a properties -> map function - (let [propname :clojure.contrib.java.test-with-system-properties - propcount (count (System/getProperties))] - (with-system-properties {propname "foo"} - (is (= (inc propcount) (count (System/getProperties))))) - (is (= propcount (count (System/getProperties)))))) -) - -(deftest test-as-properties - (let [expected (doto (Properties.) - (.setProperty "a" "b") - (.setProperty "c" "d"))] - (testing "with a map" - (is (= expected - (as-properties {:a "b" :c "d"})))) - (testing "with a sequence of pairs" - (is (= expected - (as-properties [[:a :b] [:c :d]])))))) - -(deftest test-read-properties - (let [f (File/createTempFile "test" "properties")] - (spit f "a=b\nc=d") - (is (= {"a" "b" "c" "d"} - (read-properties f))))) - -(deftest test-write-properties - (let [f (File/createTempFile "test" "properties")] - (write-properties [['a 'b] ['c 'd]] f) - (is (= {"a" "b" "c" "d"} - (read-properties f))))) - - -(deftest test-delete-file - (let [file (File/createTempFile "test" "deletion") - not-file (File. (str (java.util.UUID/randomUUID)))] - (delete-file (.getAbsolutePath file)) - (is (not (.exists file))) - (is (thrown? ArithmeticException (/ 1 0))) - (is (thrown? java.io.IOException (delete-file not-file))) - (is (delete-file not-file :silently)))) diff --git a/src/test/clojure/clojure/contrib/test_jmx.clj b/src/test/clojure/clojure/contrib/test_jmx.clj index f75c76bf..d54a477b 100644 --- a/src/test/clojure/clojure/contrib/test_jmx.clj +++ b/src/test/clojure/clojure/contrib/test_jmx.clj @@ -10,7 +10,7 @@ ;; 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-jmx +(ns clojure.contrib.test-jmx (:import javax.management.openmbean.CompositeDataSupport [javax.management MBeanAttributeInfo AttributeList] [java.util.logging LogManager Logger] diff --git a/src/test/clojure/clojure/contrib/test_json.clj b/src/test/clojure/clojure/contrib/test_json.clj index 36237ad5..564f6a49 100644 --- a/src/test/clojure/clojure/contrib/test_json.clj +++ b/src/test/clojure/clojure/contrib/test_json.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.test-contrib.test-json +(ns clojure.contrib.test-json (:use clojure.test clojure.contrib.json)) (deftest can-read-numbers diff --git a/src/test/clojure/clojure/contrib/test_lazy_seqs.clj b/src/test/clojure/clojure/contrib/test_lazy_seqs.clj index 33bbcae1..ecbe46ae 100644 --- a/src/test/clojure/clojure/contrib/test_lazy_seqs.clj +++ b/src/test/clojure/clojure/contrib/test_lazy_seqs.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.test-contrib.test-lazy-seqs +(ns clojure.contrib.test-lazy-seqs (:use clojure.test clojure.contrib.lazy-seqs)) diff --git a/src/test/clojure/clojure/contrib/test_macro_utils.clj b/src/test/clojure/clojure/contrib/test_macro_utils.clj index ac1ced06..d27b24b9 100644 --- a/src/test/clojure/clojure/contrib/test_macro_utils.clj +++ b/src/test/clojure/clojure/contrib/test_macro_utils.clj @@ -11,7 +11,7 @@ ;; 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.macro-utils +(ns clojure.contrib.test-macro-utils (:use [clojure.test :only (deftest is are run-tests use-fixtures)] [clojure.contrib.macro-utils :only (macrolet symbol-macrolet defsymbolmacro with-symbol-macros diff --git a/src/test/clojure/clojure/contrib/test_math.clj b/src/test/clojure/clojure/contrib/test_math.clj index 0d434007..d7c6eaea 100644 --- a/src/test/clojure/clojure/contrib/test_math.clj +++ b/src/test/clojure/clojure/contrib/test_math.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.math.tests
+(ns clojure.contrib.test-math
(:use clojure.test
clojure.contrib.math))
diff --git a/src/test/clojure/clojure/contrib/test_miglayout.clj b/src/test/clojure/clojure/contrib/test_miglayout.clj index dec12ba8..0ec32167 100644 --- a/src/test/clojure/clojure/contrib/test_miglayout.clj +++ b/src/test/clojure/clojure/contrib/test_miglayout.clj @@ -13,7 +13,7 @@ ;; scgilardi (gmail) ;; Created 5 October 2008 -(ns clojure.contrib.miglayout.test +(ns clojure.contrib.test-miglayout (:import (javax.swing JButton JFrame JLabel JList JPanel JScrollPane JTabbedPane JTextField JSeparator)) (:use clojure.contrib.miglayout)) diff --git a/src/test/clojure/clojure/contrib/test_mock.clj b/src/test/clojure/clojure/contrib/test_mock.clj index 1737305e..04f1d593 100644 --- a/src/test/clojure/clojure/contrib/test_mock.clj +++ b/src/test/clojure/clojure/contrib/test_mock.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.test-contrib.mock-test +(ns clojure.contrib.test-mock (:use clojure.test) (:require [clojure.contrib.mock :as mock])) diff --git a/src/test/clojure/clojure/contrib/test_monads.clj b/src/test/clojure/clojure/contrib/test_monads.clj index f523f0ec..2ec9c3e9 100644 --- a/src/test/clojure/clojure/contrib/test_monads.clj +++ b/src/test/clojure/clojure/contrib/test_monads.clj @@ -11,7 +11,7 @@ ;; 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.monads +(ns clojure.contrib.test-monads (:use [clojure.test :only (deftest is are run-tests)] [clojure.contrib.monads :only (with-monad domonad m-lift m-seq m-chain diff --git a/src/test/clojure/clojure/contrib/test_seq.clj b/src/test/clojure/clojure/contrib/test_seq.clj index 84ffbace..fafb4b05 100644 --- a/src/test/clojure/clojure/contrib/test_seq.clj +++ b/src/test/clojure/clojure/contrib/test_seq.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.test-contrib.seq-test +(ns clojure.contrib.test-seq (:use clojure.test clojure.contrib.seq)) diff --git a/src/test/clojure/clojure/contrib/test_shell.clj b/src/test/clojure/clojure/contrib/test_shell.clj index 7af31deb..120093e7 100644 --- a/src/test/clojure/clojure/contrib/test_shell.clj +++ b/src/test/clojure/clojure/contrib/test_shell.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.test-contrib.shell +(ns clojure.contrib.test-shell (:use clojure.test clojure.contrib.shell) (:import (java.io File))) diff --git a/src/test/clojure/clojure/contrib/test_sql.clj b/src/test/clojure/clojure/contrib/test_sql.clj index 4773ef06..62c91ef0 100644 --- a/src/test/clojure/clojure/contrib/test_sql.clj +++ b/src/test/clojure/clojure/contrib/test_sql.clj @@ -13,7 +13,7 @@ ;; scgilardi (gmail) ;; Created 13 September 2008 -(ns clojure.contrib.sql.test +(ns clojure.contrib.test-sql (:use [clojure.contrib.sql :as sql :only ()])) (def db {:classname "org.apache.derby.jdbc.EmbeddedDriver" diff --git a/src/test/clojure/clojure/contrib/test_string.clj b/src/test/clojure/clojure/contrib/test_string.clj index a25c3944..5b734a4a 100644 --- a/src/test/clojure/clojure/contrib/test_string.clj +++ b/src/test/clojure/clojure/contrib/test_string.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.test-contrib.string +(ns clojure.contrib.test-string (:require [clojure.contrib.string :as s]) (:use clojure.test)) diff --git a/src/test/clojure/clojure/contrib/test_trace.clj b/src/test/clojure/clojure/contrib/test_trace.clj index 88010724..4b3250f7 100644 --- a/src/test/clojure/clojure/contrib/test_trace.clj +++ b/src/test/clojure/clojure/contrib/test_trace.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.test-contrib.test-trace +(ns clojure.contrib.test-trace (:use clojure.test [clojure.contrib trace string])) diff --git a/src/test/clojure/clojure/contrib/test_with_ns.clj b/src/test/clojure/clojure/contrib/test_with_ns.clj index 61fee6e3..14ab5570 100644 --- a/src/test/clojure/clojure/contrib/test_with_ns.clj +++ b/src/test/clojure/clojure/contrib/test_with_ns.clj @@ -1,4 +1,4 @@ -(ns clojure.contrib.test-contrib.with-ns-test +(ns clojure.contrib.test-with-ns (:use clojure.test clojure.contrib.with-ns [clojure.contrib.seq :only (includes?)])) |