Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idea for E #20

Open
c-cube opened this issue Sep 20, 2015 · 1 comment
Open

idea for E #20

c-cube opened this issue Sep 20, 2015 · 1 comment

Comments

@c-cube
Copy link
Collaborator

c-cube commented Sep 20, 2015

exception tests are not easy, because you can't just use equality (for instance, the string in Invalid_argument might not be specified).

If you don't have a specific idea in mind, I propose the following semantic and syntax:

(*$E
  <exn matcher> <code to test>
*)

where <exn matcher>: exn -> bool pattern matches an exception, and <code to test>: 'a should raise an exception that is validated by <exn matcher>. A block (*$E f g *) would be encoded into

assert_bool "some message"
  ( try g; false with e -> f e )
@vincent-hugot
Copy link
Owner

Sounds logical.

There hasn't been much need for E tests in Batteries, because there are especially compact patterns for that in simple tests, but I see no reason not to implement them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants