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

Delete kani::expect_fail and associated hook #2027

Merged
merged 3 commits into from
Dec 21, 2022

Conversation

zhassan-aws
Copy link
Contributor

Description of changes:

Get rid of kani::expect_fail, and replace its usage in the regressions by kani::cover.

Resolved issues:

Resolves #1197
Resolves #1538

Related RFC:

Optional #ISSUE-NUMBER.

Call-outs:

There were many _fail tests that used kani::expect_fail that had a corresponding non-failing test that used assert. For example, a test name foo.rs would have:

let x = ...
assert!(x == 2);

and there would be a corresponding test named foo_fail.rs that has:

let x = ...
kani::expect_fail(x != 2);

These tests were essentially useless (since the main test verifies that the assertion passes), so I deleted all of them.

I only kept tests that were meaningful, and replaced kani::expect_fail with kani::cover.

Testing:

  • How is this change tested? Updated regressions

  • Is this a refactor change? No

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@zhassan-aws zhassan-aws requested a review from a team as a code owner December 21, 2022 00:27
Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

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

That's awesome! Thanks for doing this. Question, did you mean to delete or replace the DynTrait tests?

tests/kani/DynTrait/boxed_closure_fail.rs Show resolved Hide resolved
tests/expected/arbitrary/integers/expected Outdated Show resolved Hide resolved
@zhassan-aws zhassan-aws merged commit 8767fe6 into model-checking:main Dec 21, 2022
@zhassan-aws zhassan-aws deleted the delete-expect-fail branch December 21, 2022 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handling of expect_fail in the regression is broken Rename expect_fail to should_fail or other phrases.
2 participants