Skip to content

Commit 3fd3ebc

Browse files
committed
Use til::visualize_nonspace_control_codes
1 parent fe5750b commit 3fd3ebc

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

src/cascadia/UnitTests_Control/ControlInteractivityTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ namespace ControlUnitTests
109109
const auto actual = winrt_array_to_wstring_view(str);
110110
const auto expected = expectedOutput.front();
111111
expectedOutput.pop_front();
112-
Log::Comment(fmt::format(L"Received: \"{}\"", TerminalCoreUnitTests::TestUtils::ReplaceEscapes(std::wstring{ actual })).c_str());
113-
Log::Comment(fmt::format(L"Expected: \"{}\"", TerminalCoreUnitTests::TestUtils::ReplaceEscapes(expected)).c_str());
112+
Log::Comment(fmt::format(L"Received: \"{}\"", til::visualize_nonspace_control_codes(std::wstring{ actual })).c_str());
113+
Log::Comment(fmt::format(L"Expected: \"{}\"", til::visualize_nonspace_control_codes(expected)).c_str());
114114
VERIFY_ARE_EQUAL(expected, actual);
115115
});
116116

src/inc/TestUtils.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,23 +109,6 @@ class TerminalCoreUnitTests::TestUtils
109109
return iter;
110110
};
111111

112-
// Function Description:
113-
// - Replaces all escapes with the printable symbol for that escape
114-
// character. This makes log parsing easier for debugging, as the literal
115-
// escapes won't be written to the console output.
116-
// Arguments:
117-
// - wstr: the string to escape.
118-
// Return Value:
119-
// - A modified version of that string with non-printable characters replaced.
120-
static std::wstring ReplaceEscapes(std::wstring escaped)
121-
{
122-
std::replace(escaped.begin(), escaped.end(), L'\x1b', L'\x241b'); // ESC
123-
std::replace(escaped.begin(), escaped.end(), L'\x08', L'\x2408'); // BS
124-
std::replace(escaped.begin(), escaped.end(), L'\x0A', L'\x240A'); // LF
125-
std::replace(escaped.begin(), escaped.end(), L'\x0D', L'\x240D'); // CR
126-
return escaped;
127-
}
128-
129112
template<class... T>
130113
static bool VerifyLineContains(TextBufferCellIterator& actual, T&&... expectedContent)
131114
{

0 commit comments

Comments
 (0)