Skip to content

Commit

Permalink
Proposed contracts behavior/syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
abedra committed Jun 21, 2012
1 parent 4100e99 commit 54eef53
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/clojure/clojure/test/generative.clj
Expand Up @@ -389,7 +389,16 @@ one of the built-in generators:
bindings to the vars in argspecs, plus a binding of '%' to the bindings to the vars in argspecs, plus a binding of '%' to the
result of calling fn-to-test. result of calling fn-to-test.
Multiple arities in argspecs are not supported." Multiple arities in argspecs are not supported.
If contracts are provided (from core.contracts), they will be
applied to fn-to-test before the execution of the test.
(defspec score-invariants
score
[^{:tag `random-secret} secret
^{:tag `random-secret} guess]
score-contract)"
[name fn-to-test args & validator-body] [name fn-to-test args & validator-body]
(when-let [missing-tags (->> (map #(list % (-> % meta :tag)) args) (when-let [missing-tags (->> (map #(list % (-> % meta :tag)) args)
(filter (fn [[_ tag]] (nil? tag))) (filter (fn [[_ tag]] (nil? tag)))
Expand Down

0 comments on commit 54eef53

Please sign in to comment.