Skip to content
Browse files

Merge tag '0.3.0'

  • Loading branch information...
2 parents 8c7d08a + 11cd2d1 commit c69604a5026c2cd40b597f156c99af748139b016 @pjstadig committed Mar 11, 2013
View
2 .dir-locals.el
@@ -3,4 +3,4 @@
(eval ignore-errors
(require 'whitespace)
(whitespace-mode t))))
- (clojure-mode . ((clojure-test-ns-segment-position . 2))))
+ (clojure-mode . ((clojure-test-ns-segment-position . 1))))
View
4 CHANGELOG.org
@@ -1,5 +1,9 @@
#+STARTUP: hidestars showall
* conjecture changelog
+** 0.3.0
+ - Compatible with Clojure 1.2.1.
+ - Renamed groupId to conjecture.
+ - Renamed namespaces from name.stadig.* => conjecture
** 0.2.0
- Runs fixtures when you call a function as a test (e.g. at a REPL)
- Removes support for singleton fixtures. They did not provide an
View
8 README.org
@@ -3,23 +3,23 @@
A ~clojure.test~ compatible third-party testing library for Clojure. Please
contribute code and features through GitHub issues and pull requests.
** Usage
- Same as ~clojure.test~, except you pull in ~name.stadig.conjecture~.
+ Same as ~clojure.test~, except you pull in ~conjecture.core~.
For example, you would add the following dependency to your project.clj:
: :dependencies [[name.stadig/conjecture "0.2.0"]]
- Use ~name.stadig.conjecture~ in your tests:
+ Use ~conjecture.core~ in your tests:
: (ns foo.bar.test
- : (:use [name.stadig.conjecture]))
+ : (:use [conjecture.core]))
:
: (deftest test-widget
: (is (= foo bar))
: ...)
Conjecture is compatible with any ~clojure.test~ based tests you may have.
- You simply swap ~name.stadig.conjecture~ in for ~clojure.test~.
+ You simply swap ~conjecture.core~ in for ~clojure.test~.
You can add the lein-conjecture plugin to your project.clj, if that's your
style:
View
6 project.clj
@@ -1,9 +1,9 @@
-(defproject name.stadig/conjecture "0.2.0"
+(defproject conjecture "0.3.0"
:description "A clojure.test compatible third-party testing library for
Clojure."
:url "http://github.com/pjstadig/conjecture"
:license {:name "Eclipse Public License - v 1.0"
:url "http://www.eclipse.org/legal/epl-v10.html"}
- :dependencies [[org.clojure/clojure "1.5.0"]]
- :plugins [[name.stadig/lein-conjecture "0.1.0"]]
+ :dependencies [[org.clojure/clojure "1.2.1"]]
+ :plugins [[lein-conjecture "0.2.0"]]
:aliases {"test" "conjecture"})
View
20 src/name/stadig/conjecture.clj → src/conjecture/core.clj
@@ -234,7 +234,7 @@
For additional event types, see the examples in the code.
"}
- name.stadig.conjecture
+ conjecture.core
(:require [clojure.template :as temp]
[clojure.stacktrace :as stack]))
@@ -244,14 +244,14 @@
;;; USER-MODIFIABLE GLOBALS
-(defonce ^:dynamic
+(defonce ^{:dynamic true}
^{:doc "True by default. If set to false, no test functions will
be created by deftest, set-test, or with-test. Use this to omit
tests when compiling or loading production code."
:added "0.1.0"}
*load-tests* true)
-(def ^:dynamic
+(def ^{:dynamic true}
^{:doc "The maximum depth of stack traces to print when an Exception
is thrown during a test. Defaults to nil, which means print the
complete stack trace."
@@ -262,20 +262,20 @@
;;; GLOBALS USED BY THE REPORTING FUNCTIONS
;; bound to a ref of a map in test-ns
-(def ^:dynamic *report-counters* nil)
+(def ^{:dynamic true} *report-counters* nil)
;; used to initialize *report-counters*
-(def ^:dynamic *initial-report-counters*
+(def ^{:dynamic true} *initial-report-counters*
{:test 0, :pass 0, :fail 0, :error 0})
;; bound to hierarchy of vars being tested
-(def ^:dynamic *testing-vars* (list))
+(def ^{:dynamic true} *testing-vars* (list))
;; bound to hierarchy of "testing" strings
-(def ^:dynamic *testing-contexts* (list))
+(def ^{:dynamic true} *testing-contexts* (list))
;; ; bound to hierarchy of "testing" strings
-(def ^:dynamic *test-out* *out*)
+(def ^{:dynamic true} *test-out* *out*)
(defmacro with-test-out
"Runs body with *out* bound to the value of *test-out*."
@@ -711,9 +711,9 @@
(defn each-fixture-fn [ns]
(join-fixtures (::each-fixtures (meta ns))))
-(def ^:dynamic *once-fixtures* #{})
+(def ^{:dynamic true} *once-fixtures* #{})
-(def ^:dynamic *each-fixtures* #{})
+(def ^{:dynamic true} *each-fixtures* #{})
(defn test-var
"If v has a function in its :test metadata, calls that function,
View
19 src/name/stadig/conjecture/junit.clj → src/conjecture/junit.clj
@@ -9,7 +9,7 @@
;;;;
;;;; You must not remove this notice, or any other, from this software.
-;; test/junit.clj: Extension to name.stadig.conjecture for JUnit-compatible
+;; test/junit.clj: Extension to conjecture.core for JUnit-compatible
;; XML output
;; by Jason Sankey
@@ -18,29 +18,28 @@
;; DOCUMENTATION
;;
-(ns ^{:doc "name.stadig.conjecture extension for JUnit-compatible XML output.
+(ns ^{:doc "conjecture.core extension for JUnit-compatible XML output.
JUnit (http://junit.org/) is the most popular unit-testing library
for Java. As such, tool support for JUnit output formats is
common. By producing compatible output from tests, this tool
support can be exploited.
- To use, wrap any calls to name.stadig.conjecture/run-tests in the
+ To use, wrap any calls to conjecture.core/run-tests in the
with-junit-output macro, like this:
- (use 'name.stadig.conjecture)
- (use 'name.stadig.conjecture.junit)
+ (use 'conjecture.core)
+ (use 'conjecture.junit)
(with-junit-output
(run-tests 'my.cool.library))
- To write the output to a file, rebind name.stadig.conjecture/*test-out* to
- your own PrintWriter (perhaps opened using
- clojure.java.io/writer)."
+ To write the output to a file, rebind conjecture.core/*test-out* to
+ your own PrintWriter (perhaps opened using clojure.java.io/writer)."
:author "Jason Sankey"}
- name.stadig.conjecture.junit
+ conjecture.junit
(:require [clojure.stacktrace :as stack]
- [name.stadig.conjecture :as t]))
+ [conjecture.core :as t]))
;; copied from clojure.contrib.lazy-xml
(def ^{:private true}
View
15 src/name/stadig/conjecture/tap.clj → src/conjecture/tap.clj
@@ -9,7 +9,7 @@
;;;;
;;;; You must not remove this notice, or any other, from this software.
-;;; test_is/tap.clj: Extension to name.stadig.conjecture for TAP output
+;;; test_is/tap.clj: Extension to conjecture.core for TAP output
;; by Stuart Sierra
;; March 31, 2009
@@ -20,7 +20,7 @@
;; DOCUMENTATION
;;
-(ns ^{:doc "name.stadig.conjecture extensions for the Test Anything Protocol
+(ns ^{:doc "conjecture.core extensions for the Test Anything Protocol
(TAP)
TAP is a simple text-based syntax for reporting test results. TAP
@@ -30,17 +30,16 @@
http://search.cpan.org/~petdance/TAP-1.0.0/TAP.pm
To use this library, wrap any calls to
- name.stadig.conjecture/run-tests in the with-tap-output macro,
- like this:
+ conjecture.core/run-tests in the with-tap-output macro, like this:
- (use 'name.stadig.conjecture)
- (use 'name.stadig.conjecture.tap)
+ (use 'conjecture.core)
+ (use 'conjecture.tap)
(with-tap-output
(run-tests 'my.cool.library))"
:author "Stuart Sierra"}
- name.stadig.conjecture.tap
- (:require [name.stadig.conjecture :as t]
+ conjecture.tap
+ (:require [conjecture.core :as t]
[clojure.stacktrace :as stack]))
(defn print-tap-plan
View
19 test/name/stadig/test/conjecture.clj → test/conjecture/test/core.clj
@@ -17,8 +17,8 @@
;; Thanks to Chas Emerick, Allen Rohner, and Stuart Halloway for
;; contributions and suggestions.
-(ns name.stadig.test.conjecture
- (:use name.stadig.conjecture))
+(ns conjecture.test.core
+ (:use conjecture.core))
(deftest can-test-symbol
(let [x true]
@@ -34,17 +34,17 @@
(is nil "Should fail"))
(deftest can-test-=
- (is (= 2 (+ 1 1)) "Should pass")
- (is (= 3 (+ 2 2)) "Should fail"))
+ (is (= "foobar" (str "foo" "bar")) "Should pass")
+ (is (= "notfoobar" (str "foo" "bar")) "Should fail"))
(deftest can-test-instance
- (is (instance? Long (+ 2 2)) "Should pass")
- (is (instance? Float (+ 1 1)) "Should fail"))
+ (is (instance? String (str "foo" "bar")) "Should pass")
+ (is (instance? Float (str "foo" "bar")) "Should fail"))
(deftest can-test-thrown
(is (thrown? ArithmeticException (/ 1 0)) "Should pass")
;; No exception is thrown:
- (is (thrown? Exception (+ 1 1)) "Should fail")
+ (is (thrown? Exception (str "foo" "bar")) "Should fail")
;; Wrong class of exception is thrown:
(is (thrown? ArithmeticException (throw (RuntimeException.))) "Should error"))
@@ -55,7 +55,8 @@
(is (thrown-with-msg? ArithmeticException #"Something else" (/ 1 0))
"Should fail")
;; No exception is thrown:
- (is (thrown? Exception (+ 1 1)) "Should fail")
+ (is (thrown-with-msg? Exception #"Not an Exception"
+ (str "foo" "bar")) "Should fail")
;; Wrong class of exception is thrown:
(is (thrown-with-msg? IllegalArgumentException #"Divide by zero" (/ 1 0))
"Should error"))
@@ -117,7 +118,7 @@
(defn test-ns-hook []
(binding [original-report report
report custom-report]
- (test-all-vars (find-ns 'name.stadig.test.conjecture))))
+ (test-all-vars (find-ns 'conjecture.test.core))))
(deftest test-idempotent-fixture
(let [count (atom 0)
View
11 .../name/stadig/test/conjecture/fixtures.clj → test/conjecture/test/fixtures.clj
@@ -14,12 +14,15 @@
;; by Stuart Sierra
;; March 28, 2009
-(ns name.stadig.test.conjecture.fixtures
- (:use name.stadig.conjecture))
+(ns conjecture.test.fixtures
+ (:use conjecture.core))
-(declare ^:dynamic *a* ^:dynamic *b* ^:dynamic *c* ^:dynamic *d*)
+(declare ^{:dynamic true} *a*
+ ^{:dynamic true} *b*
+ ^{:dynamic true} *c*
+ ^{:dynamic true} *d*)
-(def ^:dynamic *n* 0)
+(def ^{:dynamic true} *n* 0)
(defn fixture-a [f]
(binding [*a* 3] (f)))

0 comments on commit c69604a

Please sign in to comment.
Something went wrong with that request. Please try again.