Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
$ ant jar
# If no compilation errors, 'ant jar' creates clojure.jar in Clojure tree root dir

# Or, if you prefer Maven
$ mvn -Dmaven.test.skip=true package
# If no compilation errors, mvn command above creates target/clojure-1.67.0-master-SNAPSHOT.jar

The commands above build a Clojure jar file, but neither compile nor run the tests.

...

Code Block
# Replace clojure.jar with target/clojure-1.67.0-master-SNAPSHOT.jar if you ran mvn command
$ java -cp test:clojure.jar clojure.main
Clojure 1.67.0-master-SNAPSHOT
;; We're testing with clojure.test 
=> (require 'clojure.test)
nil
;; Load a test file 
user=> (require 'clojure.test-clojure.data)
nil
;; Run it 
user=> (clojure.test/run-tests 'clojure.test-clojure.data)
 
Testing clojure.test-clojure.data
Ran 1 tests containing 17 assertions.
0 failures, 0 errors.
{:type :summary, :pass 17, :test 1, :error 0, :fail 0}   

Start a repl and run a generative test from it:

Generative tests use additional testing jars (installed when you run ./antsetup.sh). Thus, you'll need to have some additional classpath which antsetup.sh will leave in the maven-classpath file. If you are on *nix, the easiest way to leverage this file is:

Code Block
# Replace clojure.jar with target/clojure-1.7.0-master-SNAPSHOT.jar if you ran mvn command 
$ java -cp `cat maven-classpath`:test:clojure.jar clojure.main 
Clojure 1.7.0-master-SNAPSHOT 
;; Load a test file that uses test.generative
user=> (require 'clojure.test-clojure.reader)
nil
;; Load the test.generative runner ns 
user=> (use 'clojure.test.generative.runner)
nil
;; Test a specification on 1 thread for 200 ms
user=> (run 1 200 #'clojure.test-clojure.reader/types-that-should-roundtrip)
{:iter 60, :seed 1255541066, :test clojure.test-clojure.reader/types-that-should-roundtrip}
nil