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 missing [DoesNotReturn] annotations for Assert.Pass, Ignore, and Inconclusive #3958

Merged
merged 2 commits into from
Oct 11, 2021

Conversation

jnm2
Copy link
Contributor

@jnm2 jnm2 commented Oct 11, 2021

These methods always throw an exception. I noticed these were missing when if (x is null) Assert.Inconclusive(...); did not cause the compiler to understand that x was not null after that line.

Looks like I'd already figured this out for Assume.That:

/// <summary>
/// Asserts that a condition is true. If the condition is false, the
/// method throws an <see cref="InconclusiveException"/>.
/// </summary>
/// <param name="condition">The evaluated condition</param>
public static void That([DoesNotReturnIf(false)] bool condition)
{
Assume.That(condition, Is.True, null, null);
}

Copy link
Member

@mikkelbu mikkelbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'll merge it now. We should probably also backport this change to v3.13-dev?

@mikkelbu mikkelbu merged commit 989ec4b into nunit:master Oct 11, 2021
@mikkelbu mikkelbu added this to the 4.0 milestone Oct 11, 2021
rprouse added a commit that referenced this pull request Oct 25, 2021
Backport "Add missing [DoesNotReturn] annotations" from #3958
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants