Skip to content

Commit

Permalink
[Issue #82] added one more validation case taking the opts-map into a…
Browse files Browse the repository at this point in the history
…ccount
  • Loading branch information
AlexBaranosky committed Mar 15, 2012
1 parent 5906a1d commit a0caf34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 0 additions & 2 deletions FORMULAS-BACKLOG-AND-FEATURE-IDEAS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
* [x] validate that opt-map is only used with valid keys.

* [x] validate that :num-trials is 1+

* [ ] more formula syntax validation cases inspired by the new opt map

* [ ] Work with Meikel Brandmeyer to combine ClojureCheck's Generators with Shrink.
implement shrinking. Report only the first fully shrunken failure
Expand Down
11 changes: 6 additions & 5 deletions test/midje/ideas/t_formulas.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(each-causes-validation-error #"There is no expection in your formula form"
(formula [a 1])
(formula [a 1] 1)
(formula "vector fact" [a 1] (contains 3))
(formula "a doc string" [a 1] (contains 3))

(formula "ignores arrows in provideds" [a 1]
(contains 3)
Expand All @@ -38,12 +38,13 @@
(contains 3)))

(each-causes-validation-error #"Formula requires bindings to be an even numbered vector of 2 or more"
(formula "vector fact" :not-vector 1 => 1)
(formula "vector fact" [a 1 1] 1 => 1)
(formula "vector fact" [] 1 => 1))
(formula "a doc string" :not-vector 1 => 1)
(formula "a doc string" [a 1 1] 1 => 1)
(formula "a doc string" [] 1 => 1)
(formula "a doc string" {:num-trials 50} 1 => 1))

(causes-validation-error #"There are too many expections in your formula form"
(formula "vector fact" [a 1] a => 1 a => 1))
(formula "a doc string" [a 1] a => 1 a => 1))

(causes-validation-error #"Invalid keys \(:foo, :bar\) in formula's options map. Valid keys are: :num-trials"
(formula {:foo 5 :bar 6} [a 1] a => 1))
Expand Down

0 comments on commit a0caf34

Please sign in to comment.