On Oct 19, 2008, at 5:11 PM, J. McConnell wrote:
> I've been thinking the same thing for awhile now and I'd love to help
> contribute to an effort like this. Thanks for getting the idea out
> there.
You're welcome. It seems like clojure.contrib could be a more
convenient place to keep this than the wiki.
Direct or indirect contributions to clojure.contrib require that the
contributed code be written by the contributor and that the
contributor have a contributor agreement on file with Rich. Would that
be acceptable to people interested in participating? I appreciate the
care Rich showed and long view he took in coming up with the
Contributor Agreement process. I think it would be a good idea to
leverage that process for this effort as well.
Discussion of alternative proposals for a good way to do this and
place to keep it are welcome.
I made a start on this today. I started with the Reader page at
clojure.org and started making tests. I'm thinking of a structure like
this:
Run tests with:
(require 'clojure.contrib.test-clojure)
The definition of clojure.contrib.test-clojure requires subordinate
test namespaces like
'clojure.contrib.test-clojure.Reader
'clojure.contrib.test-clojure.Evaluation
'clojure.contrib.test-clojure.Special-Forms
...
with names that correspond to pages on the Clojure web site. After
requiring the individual test namespaces, test-clojure runs
"clojure.contrib.test-is/run-tests" on each one.
Here's a sample from clojure.contrib.test-clojure.
(ns clojure.contrib.test-clojure.Reader
(:use clojure.contrib.test-is))
(deftest t-Symbols
(is (= 'abc (symbol "abc")))
(is (= '*+!-_? (symbol "*+!-_?")))
(is (= 'abc:def:ghi (symbol "abc:def:ghi")))
(is (= 'abc/def (symbol "abc" "def")))
(is (= 'abc.def/ghi (symbol "abc.def" "ghi")))
(is (= 'abc/def.ghi (symbol "abc" "def.ghi")))
(is (= 'abc:def/ghi:jkl.mno (symbol "abc:def" "ghi:jkl.mno")))
(is (instance? clojure.lang.Symbol 'alphabet))
)
; additional tests to flesh out
(deftest t-Numbers)
(deftest t-Characters)
(deftest t-nil)
(deftest t-Booleans)
(deftest t-Keywords)
(deftest t-Lists)
(deftest t-Vectors)
(deftest t-Maps)
(deftest t-Sets)
(deftest t-Quote)
(deftest t-Character)
(deftest t-Comment)
(deftest t-Meta)
(deftest t-Deref)
(deftest t-Regex)
(deftest t-Metadata)
(deftest t-read)
and a run:
user=> (require 'clojure.contrib.test-clojure)
Testing #<Namespace: clojure.contrib.test-clojure.Reader>
Ran 18 tests with 10 assertions.
0 failures, 0 exceptions.
nil
user=>
(Currently the number of tests exceeds the number of assertions by so
much because of the placeholders.)
Tesing Clojure is a big project and will take a lot of work over time.
There many pieces and many interactions among them to test. The hope
is that having it available will allow Rich to make changes with an
even higher degree of confidence that they didn't have unintended
consequences and to support efforts like Chouser's ClojureScript to
bring Clojure to new platforms
Discussion and suggestions are welcome.
--Steve
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---