1 | #ifndef BANDIT_DEFAULT_FAILURE_FORMATTER_H |
---|---|
2 | #define BANDIT_DEFAULT_FAILURE_FORMATTER_H |
3 | |
4 | #include <sstream> |
5 | #include <bandit/failure_formatters/failure_formatter.h> |
6 | |
7 | namespace bandit { |
8 | namespace detail { |
9 | struct default_failure_formatter : public failure_formatter { |
10 | std::string format(const assertion_exception& err) const override { |
11 | std::stringstream ss; |
12 | if (err.file_name().size()) { |
13 | ss << err.file_name(); |
14 | |
15 | if (err.line_number()) { |
16 | ss << ":"<< err.line_number(); |
17 | } |
18 | |
19 | ss << ": "; |
20 | } |
21 | |
22 | ss << err.what(); |
23 | |
24 | return ss.str(); |
25 | } |
26 | }; |
27 | } |
28 | } |
29 | #endif |
30 |