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
2017-07-20 08:12:09 -07:00
parent f144619e7c
commit 28cabc5e28
6 changed files with 202 additions and 141 deletions
+1 -1
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;
}
}