-
Notifications
You must be signed in to change notification settings - Fork 493
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
testRandomUuid: use cppunit exception tests #1814
Conversation
Do not hand-roll tests for exception-throwing code, use the CppUnit primitives instead
Followup to PR #1811 |
continue; // success, caught a malformed UUID | ||
} | ||
CPPUNIT_FAIL("failed to reject an invalid UUID"); | ||
CPPUNIT_ASSERT_THROW(RandomUuid uuid(id.second), TextException); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit worried that uuid
is now seemingly unused, but since compilers do not seem to think so, I am OK with the current PR code.
FWIW, I would prefer something more explicit like the code below, but I do not know whether it would work.
CPPUNIT_ASSERT_THROW(RandomUuid uuid(id.second), TextException); | |
CPPUNIT_ASSERT_THROW((void)RandomUuid(id.second), TextException); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect the compilers are smart enough to notice that the RandomUuid
has external side effects on the shared/static RNG engine.
Moving test_http_range changes to their own PR (#1816). |
Do not hand-roll tests for exception-throwing code
Do not hand-roll tests for exception-throwing code
queued for backport to v6 |
Do not hand-roll tests for exception-throwing code
Do not hand-roll tests for exception-throwing code
Do not hand-roll tests for exception-throwing code
Do not hand-roll tests for exception-throwing code