
specs - issue #120
Enhancement: ExceptionClassMatcher.like should take a more specific type
What steps will reproduce the problem?
foo() must throwA[MyException] like { case m => m.myMethod() == 42 }
What is the expected output? What do you see instead?
The above code won't compile, because like takes a PartialFunction[Throwable, Boolean] as parameter. I'd suggest that PartialFunction[E, Boolean] would be expected, removing the need for pattern matching on the type of the exception.
Currently you are required to write: ... like { case m: MyException => m.myMethod() == 42 } which increases clutter.
What version of the product are you using? On what operating system?
2.8.0.Beta1_1.6.2
Please provide any additional information below.
(none)
Comment #1
Posted on Feb 19, 2010 by Helpful CatThat should work in principle, see http://bitbucket.org/mkneissl/snippets/src/08b5cad54bdb/ScalaSnippets/src/eu/kneissl/scalasnippets/ExceptionSpecification.scala for a rough demo.
Comment #2
Posted on Feb 20, 2010 by Massive Giraffe(No comment was entered for this change.)
Comment #3
Posted on Feb 21, 2010 by Massive GiraffeThanks Martin for your code sample. I've fixed the issue. Please wait a bit for me to deploy the snapshot containing the fix.
Comment #4
Posted on May 26, 2010 by Massive Giraffe(No comment was entered for this change.)
Status: Verified
Labels:
Type-Defect
Priority-Medium
Milestone-1.6.4