You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all,
I’ve been working on extending Acutest with a TEST_EXCEPTION for C, enabling exception-like tests just like the C++ ones. I always want tests for asserts and/or other non-zero exit conditions. Generally I end up with a block of tests that I uncomment every now and then to make sure they fail. I'm over this and at seeing "SHOULD FAIL" comments all over the place, so I'm going to do something about it.
I am currently focusing on the windows side of things, but will make it cross platform in the end. It's all pretty rough while I hack it out. I'll clean up and make a draft PR for your perusal soonish.
Sample of output so far, warts and all. The stderr output from exit is messing the lines up, but I'll get to that eventually.
Feature Overview
New Macros for C:
TEST_EXCEPTION(code, expected_exit_code):
Verifies that the provided code results in the expected exit condition (e.g. access violations, seg faults, custom signals), following the style of the C++ macros.
TEST_EXCEPTION_:
A variant that allows for a custom message, again, same style as the C++ ones.
Platform-Specific Support:
Windows: Handle SEH exceptions and match them against expected codes.
Unix: Use signals to detect exceptions and validate exit codes.
Request for Feedback
Feature Scope:
Does adding TEST_EXCEPTION for C make sense and align with acutest goals?
Are there any concerns about adding platform-specific handling?
Implementation Considerations:
Is mirroring the C++ API (TEST_EXCEPTION, TEST_EXCEPTION_) clear and consistent in style?
Is using shared memory acceptable? I'm trying to keep it encapsulated and simple, but I understand its a big addition for one feature(though no external dependencies of course).
Are there non shared memory ideas/solutions that I could/should have used?
Suggestions for additional use or edge cases to handle?
Next Steps
If acceptable, I’ll:
Finalize the feature implementation and clean up my fork.
Submit a pull request with accompanying tests and documentation.
The text was updated successfully, but these errors were encountered:
This is probably duplication of closed issue #31.
I just stumbled over it but I'm sure I looked for discussion on this originally, sorry.
I will think further on Martins comments from that issue. If I can make a case for it, I'll push my solution and lay the justification out. It does come with some pretty heavy implications though (eg shared mem between processes), so it'll be a pretty hard sell.
I still like the feature, so no loss. I have my version to use when hacking out stuff that I want to make sure crashes intentionally. Some code should be used gingerly. When it is a lib that can't back out gracefully, I need to know that I'm misusing it mediately.
TEST_EXCEPTION
Features for CHi all,
I’ve been working on extending Acutest with a
TEST_EXCEPTION
for C, enabling exception-like tests just like the C++ ones. I always want tests for asserts and/or other non-zero exit conditions. Generally I end up with a block of tests that I uncomment every now and then to make sure they fail. I'm over this and at seeing "SHOULD FAIL" comments all over the place, so I'm going to do something about it.I am currently focusing on the windows side of things, but will make it cross platform in the end. It's all pretty rough while I hack it out. I'll clean up and make a draft PR for your perusal soonish.
Sample of output so far, warts and all. The stderr output from exit is messing the lines up, but I'll get to that eventually.
Feature Overview
New Macros for C:
TEST_EXCEPTION(code, expected_exit_code)
:Verifies that the provided code results in the expected exit condition (e.g. access violations, seg faults, custom signals), following the style of the C++ macros.
TEST_EXCEPTION_
:A variant that allows for a custom message, again, same style as the C++ ones.
Platform-Specific Support:
Request for Feedback
Feature Scope:
TEST_EXCEPTION
for C make sense and align with acutest goals?Implementation Considerations:
TEST_EXCEPTION
,TEST_EXCEPTION_
) clear and consistent in style?Next Steps
If acceptable, I’ll:
The text was updated successfully, but these errors were encountered: