1 parent
e7186f17f0
commit
f0825fbd1a
13 files changed
+105
-36
No files matched your search
@@ -2,7 +2,7 @@
|
||||
#include <string_view>
|
||||
#include <string>
|
||||
|
||||
namespace Void::Testing::Detail::Color {
|
||||
namespace Void::Stacktrace::Color {
|
||||
inline bool g_color_enabled{true};
|
||||
|
||||
constexpr std::string_view reset = "\033[0m";
|
||||
@@ -31,4 +31,4 @@ inline std::string info(std::string_view text) { return apply(bold_cyan, tex
|
||||
inline std::string hint(std::string_view text) { return apply(dim, text); }
|
||||
inline std::string heading(std::string_view text) { return apply(bold_blue, text); }
|
||||
inline std::string emphasis(std::string_view text) { return apply(bold, text); }
|
||||
} // namespace Void::Testing::Detail::Color
|
||||
} // namespace Void::Stacktrace::Color
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
|
||||
namespace Void::Testing::Detail {
|
||||
namespace Void::Stacktrace {
|
||||
struct StackFrame {
|
||||
std::string function_name;
|
||||
std::string source_file;
|
||||
@@ -15,4 +15,4 @@ std::vector<StackFrame> capture_stacktrace(unsigned skip_frames = 0, unsigned ma
|
||||
std::string read_source_snippet(const std::string& file, int line, int context_lines = 3);
|
||||
std::string format_stacktrace(const std::vector<StackFrame>& frames);
|
||||
void print_stacktrace(std::ostream& os, const std::vector<StackFrame>& frames);
|
||||
} // namespace Void::Testing::Detail
|
||||
} // namespace Void::Stacktrace
|
||||
@@ -1,13 +1,13 @@
|
||||
#pragma once
|
||||
#include <Void/Testing/Reporter.hpp>
|
||||
#include <Void/Testing/Detail/Color.hpp>
|
||||
#include <Void/Stacktrace/Color.hpp>
|
||||
#include <ostream>
|
||||
|
||||
namespace Void::Testing {
|
||||
class ConsoleReporter final : public Reporter {
|
||||
public:
|
||||
explicit ConsoleReporter(std::ostream& os, bool color_enabled = true) : os_(os) {
|
||||
Detail::Color::g_color_enabled = color_enabled;
|
||||
Void::Stacktrace::Color::g_color_enabled = color_enabled;
|
||||
}
|
||||
void on_run_start(const RunConfig& config, int total_tests) override;
|
||||
void on_suite_start(const std::string& suite_name, int test_count) override;
|
||||
|
||||
Reference in new issue
Block a user