-
Notifications
You must be signed in to change notification settings - Fork 30
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
Exceptions are reported inconsistently #317
Comments
Can you share these tests in a GitHub repo in which we can immediately execute and reproduce the behavior you describe? |
@TysonMN thank you for the prompt response and fix. |
Oh, that is not intentional. I had read to quickly before and didn't realize there were two issues. I will check on that shortly. |
I pushed new commits. I think they fix the second issue you found, which is not including the information about the exception in the report. It would be great if you could check again. |
They do, thank you. class MarkerException : Exception
{
public MarkerException(string message) : base(message)
{
}
}
[Fact]
public void ExceptionInSelect_Action_IncludesOriginalClassMessageAndLocation()
{
void markerThrowingFunc() => throw new MarkerException("marker message");
var ex = Assert.ThrowsAny<Exception>(() =>
{
var property =
from _ in Property.ForAll(Gen.Int32(Range.Constant(0, 0)))
select markerThrowingFunc();
property.Check();
});
var exString = ex.ToString();
Assert.Contains("marker message", exString);
Assert.Contains(nameof(markerThrowingFunc), exString);
Assert.Contains(nameof(MarkerException), exString);
}
[Fact]
public void ExceptionInSelect_Func_IncludesOriginalClassMessageAndLocation()
{
bool markerThrowingFunc() => throw new MarkerException("marker message");
var ex = Assert.ThrowsAny<Exception>(() =>
{
var property =
from _ in Property.ForAll(Gen.Int32(Range.Constant(0, 0)))
select markerThrowingFunc();
property.Check();
});
var exString = ex.ToString();
Assert.Contains("marker message", exString);
Assert.Contains(nameof(markerThrowingFunc), exString);
Assert.Contains(nameof(MarkerException), exString);
} |
Yes, good idea. I also thought of that last earlier today. I just pushed more commits that make a similar assertion in the tests. |
It looks like exceptions in
Property
andProperty<bool>
are treated and reported differently, with each treatment having good and bad sides. The important aspects in question areProperty:
Output:
Notice that
Property<bool>:
Output:
Notice that
The text was updated successfully, but these errors were encountered: