summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStuart Sierra <mail@stuartsierra.com>2010-12-17 17:04:15 -0500
committerStuart Halloway <stu@thinkrelevance.com>2011-01-05 08:12:27 -0500
commit16eef0b2259d3cc0aaa95e7d7b438aeec3cdb197 (patch)
tree8a54aac1b4e7ea9b97a288c082a264fbfdeea8ca /test
parentc5673086d40f206135b99a37001c80a4016c3877 (diff)
Build and deploy with Maven 2; CLJ-681
* Real pom.xml * Simpler build.xml for local development with Ant * No Clojure plugin; uses AntRun to build Clojure * POM inheritance from Sonatype OSS deployment * Build instructions in README * Automatically builds "slim" and "sources" JARs as before * 'distribution' profile generates a ZIP * version.properties generated by the version in pom.xml * slightly different format * minor changes to clojure.core to handle version.properties * Fix tests that assumed Ant as the test driver * Tweaked run_tests.clj to work against current master
Diffstat (limited to 'test')
-rw-r--r--test/clojure/test_clojure.clj104
-rw-r--r--test/clojure/test_clojure/protocols.clj2
-rw-r--r--test/clojure/test_clojure/reader.clj2
-rw-r--r--test/clojure/test_clojure/rt.clj8
4 files changed, 6 insertions, 110 deletions
diff --git a/test/clojure/test_clojure.clj b/test/clojure/test_clojure.clj
deleted file mode 100644
index 97710f3a..00000000
--- a/test/clojure/test_clojure.clj
+++ /dev/null
@@ -1,104 +0,0 @@
-; Copyright (c) Rich Hickey. 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.
-;
-
-;; clojure.test-clojure
-;;
-;; Tests for the facilities provided by Clojure
-;;
-;; scgilardi (gmail)
-;; Created 22 October 2008
-
-(ns clojure.test-clojure
- (:require [clojure.test :as t])
- (:gen-class))
-
-(def test-names
- [:reader
- :printer
- :compilation
- :evaluation
- :special
- :macros
- :metadata
- :ns-libs
- :logic
- :predicates
- :control
- :data-structures
- :numbers
- :sequences
- :for
- :multimethods
- :other-functions
- :vars
- :refs
- :agents
- :atoms
- :parallel
- :java-interop
- :test
- :test-fixtures
- ;; libraries
- :clojure-set
- :clojure-xml
- :clojure-zip
- :protocols
- :genclass
- :main
- :vectors
- :annotations
- :pprint
- :serialization
- :rt
- :repl
- :java.io
- :string
- :java.javadoc
- :java.shell
- :transients
- :def
- :keywords
- :data
- :reflect
- :errors
- :clojure-walk
- ])
-
-(def test-namespaces
- (map #(symbol (str "clojure.test-clojure." (name %)))
- test-names))
-
-(defn run
- "Runs all defined tests"
- []
- (println "Loading tests...")
- (apply require :reload-all test-namespaces)
- (apply t/run-tests test-namespaces))
-
-(defn run-ant
- "Runs all defined tests, prints report to *err*, throw if failures. This works well for running in an ant java task."
- []
- (let [rpt t/report]
- (binding [;; binding to *err* because, in ant, when the test target
- ;; runs after compile-clojure, *out* doesn't print anything
- *out* *err*
- t/*test-out* *err*
- t/report (fn report [m]
- (if (= :summary (:type m))
- (do (rpt m)
- (if (or (pos? (:fail m)) (pos? (:error m)))
- (throw (new Exception (str (:fail m) " failures, " (:error m) " errors.")))))
- (rpt m)))]
- (run))))
-
-(defn -main
- "Run all defined tests from the command line"
- [& args]
- (run)
- (System/exit 0))
diff --git a/test/clojure/test_clojure/protocols.clj b/test/clojure/test_clojure/protocols.clj
index b28f84ec..b46fbdf2 100644
--- a/test/clojure/test_clojure/protocols.clj
+++ b/test/clojure/test_clojure/protocols.clj
@@ -75,7 +75,7 @@
(eval '(defprotocol Elusive (old-method [x])))
(eval '(defprotocol Elusive (new-method [x])))
(is (= :new-method (eval '(new-method (reify Elusive (new-method [x] :new-method))))))
- (is (fails-with-cause? IllegalArgumentException #"No method of interface: user\.Elusive found for function: old-method of protocol: Elusive \(The protocol method may have been defined before and removed\.\)"
+ (is (fails-with-cause? IllegalArgumentException #"No method of interface: .*\.Elusive found for function: old-method of protocol: Elusive \(The protocol method may have been defined before and removed\.\)"
(eval '(old-method (reify Elusive (new-method [x] :new-method))))))))
(deftype ExtendTestWidget [name])
diff --git a/test/clojure/test_clojure/reader.clj b/test/clojure/test_clojure/reader.clj
index e1ef9253..7a060345 100644
--- a/test/clojure/test_clojure/reader.clj
+++ b/test/clojure/test_clojure/reader.clj
@@ -237,7 +237,7 @@
)
(deftest reading-keywords
- (are [x y] (= x (read-string y))
+ (are [x y] (= x (binding [*ns* (the-ns 'user)] (read-string y)))
:foo ":foo"
:foo/bar ":foo/bar"
:user/foo "::foo")
diff --git a/test/clojure/test_clojure/rt.clj b/test/clojure/test_clojure/rt.clj
index 478cacb7..231e12c9 100644
--- a/test/clojure/test_clojure/rt.clj
+++ b/test/clojure/test_clojure/rt.clj
@@ -59,19 +59,19 @@
(defn prefers [] (throw (RuntimeException. "rebound!")))))
(testing "reflection cannot resolve field"
(should-print-err-message
- #"Reflection warning, NO_SOURCE_PATH:\d+ - reference to field blah can't be resolved\.\r?\n"
+ #"Reflection warning, .*:\d+ - reference to field blah can't be resolved\.\r?\n"
(defn foo [x] (.blah x))))
(testing "reflection cannot resolve instance method"
(should-print-err-message
- #"Reflection warning, NO_SOURCE_PATH:\d+ - call to zap can't be resolved\.\r?\n"
+ #"Reflection warning, .*:\d+ - call to zap can't be resolved\.\r?\n"
(defn foo [x] (.zap x 1))))
(testing "reflection cannot resolve static method"
(should-print-err-message
- #"Reflection warning, NO_SOURCE_PATH:\d+ - call to valueOf can't be resolved\.\r?\n"
+ #"Reflection warning, .*:\d+ - call to valueOf can't be resolved\.\r?\n"
(defn foo [] (Integer/valueOf #"boom"))))
(testing "reflection cannot resolve constructor"
(should-print-err-message
- #"Reflection warning, NO_SOURCE_PATH:\d+ - call to java.lang.String ctor can't be resolved\.\r?\n"
+ #"Reflection warning, .*:\d+ - call to java.lang.String ctor can't be resolved\.\r?\n"
(defn foo [] (String. 1 2 3)))))
(def example-var)