Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

tests: Use#[should_panic] instead of#[ignore] where possible#7875

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
RenjiSann wants to merge2 commits intouutils:main
base:main
Choose a base branch
Loading
fromRenjiSann:test-ignore-to-should-panic

Conversation

RenjiSann
Copy link
Collaborator

No description provided.

@github-actionsGitHub Actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

@sylvestre
Copy link
Contributor

many jobs are failing :)

@RenjiSannRenjiSann marked this pull request as draftMay 5, 2025 07:49
@RenjiSann
Copy link
CollaboratorAuthor

Yes, looks harder than what I anticipated ^^'

@RenjiSannRenjiSannforce-pushed thetest-ignore-to-should-panic branch froma0018af to80567e3CompareMay 5, 2025 07:53
@github-actionsGitHub Actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@BenWiederhake
Copy link
Collaborator

In many cases, a test is correct and should pass – but the feature that's being tested is implemented incorrectly. In those cases, "should_panic" is just wrong. For example,test_bre11 is perfectly fine, just our implementation is buggy.

Arguably,ignore isn'tcorrect, but it's a better way thanshould_panic to deal with the fact that it's a known issue.

cakebaker reacted with thumbs up emoji

@RenjiSann
Copy link
CollaboratorAuthor

Arguably,ignore isn'tcorrect, but it's a better way thanshould_panic to deal with the fact that it's a known issue.

I understand, but I tend to disagree. Ignoring a test will skip it no matter what, so if we were to fix it by accident, we wouldn't notice and could regress it without even knowing it. Using#[should_panic] allows us to detect when a test weexpect to fail (be it because of upstream bugs, or non-implemented features) actually passes.

I agree that bothignore andshould_panic are semantically incorrect. At my work place, we have a testsuite framework that acceptsPASS,FAIL,SKIP, andXFAIL (expected fail) for a test result, and one can specify the reason behind the expected fail. I wanted to replicate that XFAIL within the coreutils¸ but even though, Rust's framework will still reportPASS for a test that successfully panics, when I'd want "XFAIL" or something similar.

In any cases, I don't have a very strong feeling about this. I think it could help, but I may be mistaken.

Regarding the expr'sbre11 testcase, the issue actually comes down to a bug in the oniguruma bindings crate. Dunno if we want to look for an alternative now that it was archived, but that's a matter for another issue.

@BenWiederhake
Copy link
Collaborator

Yup, you convinced me: Detecting a "fix by accident" is helpful, I'm in favor of it, now. Is there a way to make sure it's easily distinguishable from "really should panic", instead of "currently panics, and if it ever doesn't, then plz change this, because panicking is actually wrong".

Maybe something like this?

#[should_panic] // Should NOT panic! This test documents known issue #XXXX.

@RenjiSann
Copy link
CollaboratorAuthor

Maybe something like this?

#[should_panic] // Should NOT panic! This test documents known issue #XXXX.

Agreed 👍

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@RenjiSann@sylvestre@BenWiederhake

[8]ページ先頭

©2009-2025 Movatter.jp