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

junit - handle tests without names #1419

Closed
wants to merge 1 commit into from
Closed

Conversation

jeremylt
Copy link
Member

@jeremylt jeremylt commented Dec 7, 2023

The extra , in TAP mode when the test doesn't have a name was driving me a little batty

@@ -384,8 +385,9 @@ def run_test(index: int, test: str, spec: TestSpec, backend: str,

# run test
skip_reason: str = suite_spec.check_pre_skip(test, spec, backend, nproc)
test_name_str: str = f'"{spec.name}", ' if spec.name else ''
Copy link
Member

Choose a reason for hiding this comment

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

Should we require that all tests be named (many testing frameworks do), or perhaps automatically assign them names?

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding names would be a lot of changes to almost every test file. I'm not opposed, but its also another thing to manually change every time we make a new test. I could go either way

Copy link
Member

Choose a reason for hiding this comment

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

It looks like every file with more than one test names them. We could assert that (if you have multiple tests they all need names), but I feel like the sed operation to add name="default", to all the unnamed ones in t*.c files is also fine. One thing I've considered is using libtest-mimic to support using cargo test to run these tests, and if I do that, I'll need to name them all (either explicitly or programmatically).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm good with either approach

@jeremylt jeremylt closed this Dec 7, 2023
@jeremylt jeremylt deleted the jeremy/unnamed-test branch January 30, 2024 21:33
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.

3 participants