Skip to content

Instantly share code, notes, and snippets.

@jeremyBanks
Created December 8, 2010 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyBanks/d77cdcf74e023bc205e3 to your computer and use it in GitHub Desktop.
Save jeremyBanks/d77cdcf74e023bc205e3 to your computer and use it in GitHub Desktop.
Testing `cake test` modification.
.cake
pom.xml
*.jar
*.war
lib
classes
build
./cake-testing

Here is output showing values of *stack-trace-depth*. This is for a StackOverflow question.

Loading test/cake_test/core.clj:

Loading tests: *stack-trace-depth* is nil in
#<Thread Thread[thread-13,5,main]>

$ cake test

Defining task: *stack-trace-depth* is 5 in
#<Thread Thread[Thread-18,5,main]>
In test: *stack-trace-depth* is nil in
#<Thread Thread[Thread-16,5,main]>

Testing cake-testing.core

FAIL in (test-stack-trace-depth) (core.clj:8)
expected: (= *stack-trace-depth* 5)
  actual: (not (= nil 5))

Ran 1 tests containing 1 assertions.
1 failures, 0 errors.
----
Finished in 0.011865 seconds.
(ns cake-testing.core)
(ns cake-testing.core
(:use clojure.test))
(println "Loading tests: *stack-trace-depth* is" *stack-trace-depth* "in" (Thread/currentThread))
(deftest test-stack-trace-depth
(println "In test: *stack-trace-depth* is" *stack-trace-depth* "in" (Thread/currentThread))
(is (= *stack-trace-depth* 5)))
(defproject cake-testing "0.0.1-SNAPSHOT"
:description "Trying to make `cake test` work RE: S.O. Question #4356444."
:dependencies [[clojure "1.2.0"] [clojure-contrib "1.2.0"]])
(ns tasks
(:use cake cake.core cake.tasks.test
[clojure.test :only [*stack-trace-depth*]]))
(undeftask test)
(deftask test #{compile}
(.bindRoot #'*stack-trace-depth* 5)
(println "Defining task: *stack-trace-depth* is" *stack-trace-depth* "in" (Thread/currentThread))
(run-project-tests))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment