Skip to content

Commit

Permalink
updated to match changes to test-is/are
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthalloway committed Jan 25, 2009
1 parent 33c65f2 commit 18ca224
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
16 changes: 7 additions & 9 deletions examples/build-clojure.clj
@@ -1,6 +1,4 @@
(use 'lancet)
(require 'lancet.ant)
(alias 'ant 'lancet.ant)

(def src "src")
(def jsrc (str src "/jvm"))
Expand All @@ -11,28 +9,28 @@

(deftarget test-target
"Simple echo to test plumbing"
(ant/echo {:message "test target"}))
(echo {:message "test target"}))

(deftarget init
(ant/tstamp)
(ant/mkdir {:dir build}))
(tstamp {})
(mkdir {:dir build}))

(deftarget compile
"Compile Java sources."
(init)
(ant/javac {:srcdir jsrc :destdir build
(javac {:srcdir jsrc :destdir build
:includejavaruntime "yes"
:debug "true"
:target "1.5"}))

(deftarget clean
"Remove autogenerated files and directories"
(ant/delete {:dir build}))
(delete {:dir build}))

(deftarget jar
(deftarget make-jar
"Create jar file."
(compile)
(ant/jar {:jarfile clojure_jar
(jar {:jarfile clojure_jar
:basedir build}))

;; TODO: tie together ant tasks and subsidiary data types
Expand Down
4 changes: 2 additions & 2 deletions lancet/test/ant.clj
Expand Up @@ -10,9 +10,9 @@

(deftest test-ant-project
(let [listeners (.getBuildListeners ant-project)]
(are =
(is (=
(count (filter #(= (class %) org.apache.tools.ant.NoBannerLogger) listeners))
1
1)
)))

(deftest test-instantiate-task
Expand Down
6 changes: 3 additions & 3 deletions lancet/test/coerce.clj
Expand Up @@ -3,7 +3,7 @@
(:use lancet))

(deftest boolean-coerce
(are =
(are (= _1 _2)
(coerce Boolean/TYPE "yes") true
(coerce Boolean/TYPE "YES") true
(coerce Boolean/TYPE "on") true
Expand All @@ -14,9 +14,9 @@
(coerce Boolean/TYPE "foo") false))

(deftest file-coerce
(are =
(are (= _1 _2)
(coerce java.io.File "foo") (java.io.File. "foo")))

(deftest default-coerce
(are =
(are (= _1 _2)
(coerce Comparable 10) 10))
6 changes: 3 additions & 3 deletions lancet/test/lancet.clj
Expand Up @@ -14,17 +14,17 @@

(deftest test-task-names
(let [some-names #{'echo 'mkdir}]
(are =
(are (= _1 _2)
(intersection (into #{} (task-names)) some-names) some-names)))

(deftest test-safe-ant-name
(are =
(are (= _1 _2)
(safe-ant-name 'echo) 'echo
(safe-ant-name 'import) 'ant-import))

(deftest test-define-all-ant-tasks-defines-echo
(let [echo-task (echo {:description "foo"})]
(are =
(are (= _1 _2)
(.getDescription echo-task) "foo"
(class echo-task) org.apache.tools.ant.taskdefs.Echo)))

10 changes: 5 additions & 5 deletions lancet/test/runonce.clj
Expand Up @@ -13,30 +13,30 @@

; TODO: add nested contexts to test-is, a la PCL
; initial state
(are =
(are (= _1 _2)
(has-run?) false
@counter 0)

; run the fn
(f)
(are =
(are (= _1 _2)
(has-run?) true
@counter 1)

; run the fn again (no change)
(f)
(are =
(are (= _1 _2)
(has-run?) true
@counter 1)

; reset the fn
(reset)
(are =
(are (= _1 _2)
(has-run?) false)

; run the fn again
(f)
(are =
(are (= _1 _2)
(has-run?) true
@counter 2)
))

0 comments on commit 18ca224

Please sign in to comment.