From 0870c7965f2bbb1258513cb73ad0a2c290dbac4e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 29 Mar 2016 22:42:21 -0400 Subject: [PATCH] Tests: Fixed bug in ::diag --- test/test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test.cpp b/test/test.cpp index de1e9f1d..60ddd3cf 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -416,7 +416,9 @@ void UnitTest::diag (const std::string& text) { auto start = text.find_first_not_of (" \t\n\r\f"); auto end = text.find_last_not_of (" \t\n\r\f"); - std::cout << "# " << text.substr (start, end - start + 1) << "\n"; + if (start != std::string::npos && + end != std::string::npos) + std::cout << "# " << text.substr (start, end - start + 1) << "\n"; } ///////////////////////////////////////////////////////////////////////////////