1 | #ifndef BANDIT_VISUAL_STUDIO_FAILURE_FORMATTER_H |
---|---|
2 | #define BANDIT_VISUAL_STUDIO_FAILURE_FORMATTER_H |
3 | |
4 | #include <sstream> |
5 | #include <bandit/failure_formatters/failure_formatter.h> |
6 | |
7 | namespace bandit { |
8 | namespace detail { |
9 | struct visual_studio_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 | } else { |
21 | ss << "bandit: "; |
22 | } |
23 | |
24 | ss << err.what(); |
25 | |
26 | return ss.str(); |
27 | } |
28 | }; |
29 | } |
30 | } |
31 | #endif |
32 |