Permalink
Browse files

& doesn't have to be a checker - it just has to have a value

  • Loading branch information...
1 parent 5f8bc43 commit 64a61c6662b7d25e04ae65b825fc41a1063c7805 @marick committed Mar 20, 2013
Showing with 6 additions and 7 deletions.
  1. +6 −1 src/midje/checkers.clj
  2. +0 −6 src/midje/checking/checkers/simple.clj
View
@@ -3,6 +3,11 @@
midje.checkers
(:use midje.clojure.core))
+
+(when-not (resolve '&)
+ (let [docstring "This var is defined so that Midje prerequisites can use & for optional args without having to quote it."]
+ (intern *ns* (vary-meta '& assoc :doc docstring) docstring)))
+
(letfn [(republish [namespace symbols]
(require namespace)
(doseq [sym symbols]
@@ -17,7 +22,7 @@
(republish 'midje.checking.checkers.chatty
'[chatty-checker])
(republish 'midje.checking.checkers.simple
- '[truthy falsey TRUTHY FALSEY & anything irrelevant exactly throws roughly])
+ '[truthy falsey TRUTHY FALSEY anything irrelevant exactly throws roughly])
(republish 'midje.checking.checkers.combining
'[every-checker some-checker])
(republish 'midje.checking.checkers.collection
@@ -24,12 +24,6 @@
(not actual))
(defalias FALSEY falsey)
-;; This checker doesn't actually do anything. It's used
-;; to match the `&` notation in prerequisite argument lists.
-(defchecker &
- "Any arity"
- [actual])
-
(defchecker anything
"Accepts any value."
[actual]

1 comment on commit 64a61c6

Contributor

josephwilk commented on 64a61c6 Mar 20, 2013

Ah, I was wondering how to do something like that. Nice!

Please sign in to comment.