mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Make Formatter a non-interface
I had originally created `Formatter` as an interface as I was intending to implement this differently for linux and windows (for terminal coloring). Color printing is instead implemented by the `Printer` interface / PIMPL classes. Replace the multi-boolean constructor with a `Style` struct, as this will make life easier when we want to add / remove flags. Bug: tint:282 Change-Id: I630073ed7a76c023348b66e8a8517b00b2b6a0d2 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31569 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
28f7764704
commit
ecea5c8aec
@@ -104,7 +104,8 @@ class ParserImpl {
|
||||
|
||||
/// @returns the parser error string
|
||||
std::string error() const {
|
||||
return diag::Formatter::create(false, false, false)->format(diags_);
|
||||
diag::Formatter formatter{{false, false, false}};
|
||||
return formatter.format(diags_);
|
||||
}
|
||||
|
||||
/// @returns the diagnostic messages
|
||||
|
||||
@@ -23,16 +23,14 @@ namespace {
|
||||
|
||||
class ParserImplErrorTest : public ParserImplTest {};
|
||||
|
||||
#define EXPECT(SOURCE, EXPECTED) \
|
||||
do { \
|
||||
std::string source = SOURCE; \
|
||||
std::string expected = EXPECTED; \
|
||||
auto* p = parser(source); \
|
||||
EXPECT_EQ(false, p->Parse()); \
|
||||
EXPECT_EQ(true, p->diagnostics().contains_errors()); \
|
||||
EXPECT_EQ( \
|
||||
expected, \
|
||||
diag::Formatter::create(true, true, true)->format(p->diagnostics())); \
|
||||
#define EXPECT(SOURCE, EXPECTED) \
|
||||
do { \
|
||||
std::string source = SOURCE; \
|
||||
std::string expected = EXPECTED; \
|
||||
auto* p = parser(source); \
|
||||
EXPECT_EQ(false, p->Parse()); \
|
||||
EXPECT_EQ(true, p->diagnostics().contains_errors()); \
|
||||
EXPECT_EQ(expected, diag::Formatter().format(p->diagnostics())); \
|
||||
} while (false)
|
||||
|
||||
TEST_F(ParserImplErrorTest, AdditiveInvalidExpr) {
|
||||
|
||||
Reference in New Issue
Block a user