Add BEAST_EXPECTS test failure macro:

New overloads of suite::expect take the file and line number
as individual parameters, cleaning up the file name output
by showing only the filename part (to not leak the full path,
which might contain sensitive information).

A new macro BEAST_EXPECTS allows an additional reason
string as well as reporting the file and line. Typical usage:

    ```
    error_code ec;
    ...
    if(! BEAST_EXPECTS(! ec, ec.message()))
        return;
    ```
This commit is contained in:
Vinnie Falco
2016-08-29 13:28:08 -04:00
parent dadbab4c0f
commit 253f138aff
6 changed files with 202 additions and 141 deletions

View File

@@ -74,7 +74,7 @@ public:
Parser p;
error_code ec;
p.write(sb.data(), ec);
if(! expect(! ec, ec.message()))
if(! BEAST_EXPECTS(! ec, ec.message()))
log << to_string(sb.data()) << std::endl;
}
}