hyperfiddle / rcf

RCF – a REPL-first, async test macro for Clojure/Script
MIT License
278 stars 12 forks source link

idea: richer support for pattern matching Exceptions #39

Open dustingetz opened 2 years ago

dustingetz commented 2 years ago

Should be able to do something cool with unification, so that this "documentation of proof of bug" is fully semantic

(tests
  (p/run2 (p/vars hash-map true?) (! ~#'(when (true? true) :ok)))
  % := :ok ; pass
​
  (p/run2 (p/vars hash-map true?) (! ~#'(when (true? ~@ true) :ok)))
  % := :ok
  ;; FAIL
  ;; java.lang.ClassCastException: class hfdl.impl.runtime.Failure cannot be cast to class clojure.lang.IFn
  ;; at hfdl.impl.util$bind_flow$fn__50103.invoke(util.cljc:128)
  ;; at hfdl.impl.switch$transfer_BANG_$fn__50158.invoke(switch.cljc:89)
  ;; at hfdl.impl.switch$transfer_BANG_.invokeStatic(switch.cljc:89)
  ;; at hfdl.impl.switch$transfer_BANG_.invoke(switch.cljc:50)
  ;; at hfdl.impl.switch$switch$fn__50162.invoke(switch.cljc:114)
  ;; at missionary.impl.Reactor.publish(Reactor.java:390)
  )
dustingetz commented 2 years ago

Consider introducing an operator :! to indicate "this is an expected failure acknowledging a bug, until fixed it should not fail the suite so count it as pass"