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

Update ClientTest.cc #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update ClientTest.cc #13

wants to merge 2 commits into from

Conversation

MattPD
Copy link

@MattPD MattPD commented Jan 14, 2015

Seems that ASSERT_* versions are more appropriate than EXPECT_* here, given the following Google Test guideline:

  • "ASSERT_* versions generate fatal failures when they fail, and abort the current function. EXPECT_* versions generate nonfatal failures, which don't abort the current function. Usually EXPECT_* are preferred, as they allow more than one failures to be reported in a test. However, you should use ASSERT_* if it doesn't make sense to continue when the assertion in question fails."

Source: https://code.google.com/p/googletest/wiki/Primer#Assertions

This replaces EXPECT_* with ASSERT_* in the contexts where attempting to continue results in dereferencing a null pointer -- which is undefined behavior: https://stackoverflow.com/questions/6793262/why-dereferencing-a-null-pointer-is-undefined-behaviour

Seems that `ASSERT_*` versions are more appropriate than `EXPECT_* here, given the following Google Test guideline:
- "ASSERT_* versions generate fatal failures when they fail, and abort the current function. EXPECT_* versions generate nonfatal failures, which don't abort the current function. Usually EXPECT_* are preferred, as they allow more than one failures to be reported in a test. However, you should use ASSERT_* if it doesn't make sense to continue when the assertion in question fails."

Source: https://code.google.com/p/googletest/wiki/Primer#Assertions

This replaces `EXPECT_*` with `ASSERT_*` in the context where continuing would lead to dereferencing a null pointer -- which is undefined behavior: https://stackoverflow.com/questions/6793262/why-dereferencing-a-null-pointer-is-undefined-behaviour
Amending w/ one more null-ptr-dereference fix.
@MattPD
Copy link
Author

MattPD commented Jan 14, 2015

This (i.e., commit 0c0cf85) fixed the segmentation faults (cf. Travis CI output for commit 5ea891a). The test suite is now able to finish -- remaining test failures seem attributable to connection timeouts, which may be local to the testing environment; @DavidTompkins / others, please advise :-)

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.

1 participant