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

Add more matchers #3

Open
follesoe opened this issue Jun 30, 2012 · 1 comment
Open

Add more matchers #3

follesoe opened this issue Jun 30, 2012 · 1 comment

Comments

@follesoe
Copy link
Contributor

Currently we only have toBe, toEqual and toBeNil. We should probably add more matchers such as:

  • toHaveSlot to check if a object has a given slot
  • toContain to check if a List/Map contains an object
  • toBeTrue and toBeFalse to check boolean expressions
  • toThrow to check or exceptions

Adding the toThrow will greatly simplify our own testing of matchers, so it would make sense to implement this one first.

@follesoe
Copy link
Contributor Author

follesoe commented Jul 1, 2012

The toThrow matcher can be extended to take an expected parameter.

  • If the parameter is nil, then simply check if an exception is thrown (current implementation)
  • If the parameter is a Sequence, check that an exception is thrown, and that the error message matches.
  • If the parameter is a Exception object, check that the exception thrown is of same type, and same message as the expected exception.

leavengood added a commit to leavengood/jasmineio that referenced this issue Oct 1, 2012
Added new methods toThrowWithMessage and toThrowWithType which are
automatically called from toThrow based on the type of the expected
parameter. They could also be called explicitly.

Add associated specs as well.
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
@follesoe and others