Right now expect.fn.toThrowException matches exceptions based on ==. I could easily imagine wanting to ignore a message and just match on the constructor itself. E.g. I just want to make sure an Invalid_argument is thrown, I don't care what the message is for the purposes of my test.
I could see this also being applicable for floats or really for any string arguments to an exception constructor.
Adding the ability to specify a custom ~equals function that defaults to == would address all these concerns and be consistent with what we do for floats/arrays/lists/expectEqual etc.
This would be a great first issue for anyone to pick up. The relevant code can be found int he FnMatchers.re file
Right now
expect.fn.toThrowException
matches exceptions based on==
. I could easily imagine wanting to ignore a message and just match on the constructor itself. E.g. I just want to make sure anInvalid_argument
is thrown, I don't care what the message is for the purposes of my test.I could see this also being applicable for floats or really for any string arguments to an exception constructor.
Adding the ability to specify a custom
~equals
function that defaults to==
would address all these concerns and be consistent with what we do for floats/arrays/lists/expectEqual etc.This would be a great first issue for anyone to pick up. The relevant code can be found int he FnMatchers.re file