From 9dbdc7b57fff4034f93b10373db38630cf4634ee Mon Sep 17 00:00:00 2001 From: Bas Vodde Date: Mon, 9 Sep 2024 18:02:09 +0200 Subject: [PATCH] Revert "Encode newlines for -ojunit as their XML equivalent instead of {newline}" --- src/CppUTest/JUnitTestOutput.cpp | 3 +-- tests/CppUTest/JUnitOutputTest.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/CppUTest/JUnitTestOutput.cpp b/src/CppUTest/JUnitTestOutput.cpp index f509d9b72..4e5c2585b 100644 --- a/src/CppUTest/JUnitTestOutput.cpp +++ b/src/CppUTest/JUnitTestOutput.cpp @@ -209,8 +209,7 @@ SimpleString JUnitTestOutput::encodeXmlText(const SimpleString& textbody) buf.replace("\"", """); buf.replace("<", "<"); buf.replace(">", ">"); - buf.replace("\r", " "); - buf.replace("\n", " "); + buf.replace("\n", "{newline}"); return buf; } diff --git a/tests/CppUTest/JUnitOutputTest.cpp b/tests/CppUTest/JUnitOutputTest.cpp index da49b6e43..238963049 100644 --- a/tests/CppUTest/JUnitOutputTest.cpp +++ b/tests/CppUTest/JUnitOutputTest.cpp @@ -544,7 +544,7 @@ TEST(JUnitOutputTest, testFailureWithNewlineInIt) outputFile = fileSystem.file("cpputest_testGroupWithFailingTest.xml"); - STRCMP_EQUAL("\n", outputFile->line(6)); + STRCMP_EQUAL("\n", outputFile->line(6)); } TEST(JUnitOutputTest, testFailureWithDifferentFileAndLine) @@ -755,5 +755,5 @@ TEST(JUnitOutputTest, UTPRINTOutputInJUnitOutputWithSpecials) .end(); outputFile = fileSystem.file("cpputest_groupname.xml"); - STRCMP_EQUAL("The <rain> in "Spain" Goes \\mainly\\ down the Dr&in \n", outputFile->lineFromTheBack(3)); + STRCMP_EQUAL("The <rain> in "Spain"{newline}Goes \\mainly\\ down the Dr&in{newline}\n", outputFile->lineFromTheBack(3)); }