Skip to content

Commit

Permalink
Throw, instead of asserting for Coverity Scan
Browse files Browse the repository at this point in the history
Since the latter won't help in release mode. This is still test code
only. Otherwise, we'd do something a little more formal.
  • Loading branch information
pcolby committed Apr 8, 2015
1 parent 48a418b commit bcfa65c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/unit/src/fake_libpcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ void __pmNotifyErr(int /*priority*/, const char */*message*/, ...)

int __pmParseDebug(const char *spec)
{
// The first this the real __pmParseDebug does is dereference spec.
assert(spec != NULL);
// The first thing the real __pmParseDebug does is dereference spec.
if (spec == NULL) {
throw "spec must not be NULL";
}

// Allow our unit tests to invoke an error response.
if (strcmp(spec, "invalid") == 0) {
Expand Down

0 comments on commit bcfa65c

Please sign in to comment.