mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
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:
@@ -241,7 +241,7 @@ public:
|
||||
error_code ec;
|
||||
string_write_stream ss(ios_);
|
||||
async_write(ss, m, do_yield[ec]);
|
||||
if(expect(! ec, ec.message()))
|
||||
if(BEAST_EXPECTS(! ec, ec.message()))
|
||||
BEAST_EXPECT(ss.str ==
|
||||
"HTTP/1.0 200 OK\r\n"
|
||||
"Server: test\r\n"
|
||||
@@ -260,7 +260,7 @@ public:
|
||||
error_code ec;
|
||||
string_write_stream ss(ios_);
|
||||
async_write(ss, m, do_yield[ec]);
|
||||
if(expect(! ec, ec.message()))
|
||||
if(BEAST_EXPECTS(! ec, ec.message()))
|
||||
BEAST_EXPECT(ss.str ==
|
||||
"HTTP/1.1 200 OK\r\n"
|
||||
"Server: test\r\n"
|
||||
|
||||
Reference in New Issue
Block a user