Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added failing future-fact around the thunked =streams=> work

  • Loading branch information...
commit 33e5ee1b46a7c59ce43069bc33105fc115e2a3f3 1 parent a881a95
AlexBaranosky AlexBaranosky authored
6 src/midje/internal_ideas/fakes.clj
@@ -38,7 +38,7 @@
38 38
39 39 ;;; Potential transformations of the right-hand-side of fakes
40 40
41   -(defn on-demand
  41 +(defn- on-demand
42 42 "Produce value of next thunk on each successive call."
43 43 [thunks]
44 44 (let [the-stream (atom thunks)]
@@ -56,8 +56,8 @@
56 56
57 57 (defmethod updated-rhs (name =streams=>) [arrow rhs]
58 58 (pred-cond rhs
59   - vector? `(repeatedly (on-demand (to-thunks ~rhs)))
60   - quoted-list-form? `(repeatedly (on-demand (to-thunks ~(second rhs))))
  59 + vector? `(repeatedly (#'on-demand (to-thunks ~rhs)))
  60 + quoted-list-form? `(repeatedly (#'on-demand (to-thunks ~(second rhs))))
61 61 seq rhs
62 62 :else (throw (user-error
63 63 "This form doesn't look like a valid right-hand-side for =streams=>:"
16 test/as_documentation/t_streaming_prerequisites.clj
@@ -175,3 +175,19 @@
175 175 (throw (Exception. "shorter"))
176 176 (throw (Exception. "i am long")) ]))
177 177
  178 +
  179 +;; Seems like a simpler way to get a similar failure as the above
  180 +
  181 +;; -- is this related to the way Clojure wraps exceptions in Runtime exceptions?
  182 +;; -- I'm not sure under which circumstances said wrapping happens
  183 +
  184 +(defn a [])
  185 +(defn b [] (a) (a) (a))
  186 +
  187 +(future-fact "prerequisites can throw throwables using =streams=>"
  188 + (b) => (throws Exception "foo")
  189 + (provided
  190 + (a) =streams=> [:no-problem
  191 + :fine
  192 + (throw (Exception. "foo"))
  193 + (throw (Exception. "bar"))]))

0 comments on commit 33e5ee1

Please sign in to comment.
Something went wrong with that request. Please try again.