diff --git a/src/framework/GoogleTest/GoogleTestExecutable.ts b/src/framework/GoogleTest/GoogleTestExecutable.ts index 50928b1e..d8a3a49a 100644 --- a/src/framework/GoogleTest/GoogleTestExecutable.ts +++ b/src/framework/GoogleTest/GoogleTestExecutable.ts @@ -506,10 +506,16 @@ class FailureProcessor implements LineProcessor { private readonly fullMsg: string, ) {} + private treatRemainingAsPart: boolean = false; private lines: string[] = []; online(line: string): void | false { - if (acceptedAndDecoratedPrefixes.some(prefix => line.startsWith(prefix))) { + if (this.treatRemainingAsPart) { + if (line.startsWith('[')) { + return false; + } + this.lines.push(line); + } else if (acceptedAndDecoratedPrefixes.some(prefix => line.startsWith(prefix))) { if (isDecorationEnabled) { const first = line.indexOf(':'); if (first != -1) { @@ -529,6 +535,9 @@ class FailureProcessor implements LineProcessor { this.lines.push(line); } else if (line.startsWith(' ')) { this.lines.push(line); /* special prefix. This might cause some issue */ + } else if (line.startsWith('Failed')) { + this.lines.push(line); + this.treatRemainingAsPart = true; } else { return false; } diff --git a/test/cpp/gtest/gtest1.cpp b/test/cpp/gtest/gtest1.cpp index 95087205..af2f38cd 100644 --- a/test/cpp/gtest/gtest1.cpp +++ b/test/cpp/gtest/gtest1.cpp @@ -159,4 +159,17 @@ TEST(CppMateTest, LeadingWhitespace) << "- Third line\n" << " Fourth line\n"; FAIL() << "bad whitespace"; +} + +TEST(ThisTest, FailsWithContext) { + FAIL() << "This test fails with context"; +} + +TEST(ThisTest, FailsWithEmpty) { + FAIL(); + std::cout << "not related"; +} + +TEST(ThisTest, AlsoFailsWithContext) { + ASSERT_EQ(1, 2) << "Value of [" << 1 << "] is not equal to [" << 2 << "]"; } \ No newline at end of file