Fixed trim() for single char strings (github #75)

This commit is contained in:
Phil Nash 2012-02-28 20:04:25 +00:00
parent 97668c76f1
commit af8d0b3955
5 changed files with 26 additions and 3 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ Release
.DS_Store .DS_Store
xcuserdata xcuserdata
CatchSelfTest.xcscheme CatchSelfTest.xcscheme
Breakpoints.xcbkptlist

View File

@ -16,7 +16,7 @@
#ifdef CATCH_PLATFORM_WINDOWS #ifdef CATCH_PLATFORM_WINDOWS
#include "windows.h" #include <windows.h>
namespace Catch namespace Catch
{ {

View File

@ -136,7 +136,7 @@ namespace Catch
std::string::size_type start = str.find_first_not_of( "\n\r\t " ); std::string::size_type start = str.find_first_not_of( "\n\r\t " );
std::string::size_type end = str.find_last_not_of( "\n\r\t " ); std::string::size_type end = str.find_last_not_of( "\n\r\t " );
return start < end ? str.substr( start, 1+end-start ) : ""; return start != std::string::npos ? str.substr( start, 1+end-start ) : "";
} }

View File

@ -169,3 +169,9 @@ TEST_CASE( "./misc/xmlentitycheck", "" )
// No test // No test
} }
} }
TEST_CASE( "./manual/onechar", "send a single char to INFO" )
{
INFO(3);
REQUIRE(false);
}

View File

@ -2,4 +2,20 @@
<Bucket <Bucket
type = "1" type = "1"
version = "1.0"> version = "1.0">
<FileBreakpoints>
<FileBreakpoint
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
isPathRelative = "0"
filePath = "/Users/Phil/Dev/TwoBlueCubes/Dev/GitHub/CatchBugFix/include/internal/catch_interfaces_reporter.h"
timestampString = "352151729.244063"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "139"
endingLineNumber = "139"
landmarkName = "trim( const std::string&amp; str )"
landmarkType = "7">
</FileBreakpoint>
</FileBreakpoints>
</Bucket> </Bucket>