From f1d6b50ac5a014a5cd87a605bd4f4e1e6342ef7d Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 14 Aug 2007 14:37:22 +0000 Subject: Fixed a crash in the FString::prepend function on a null string corner case. Also added more tests to the FString unit tests and switched the ParamProc to using FString instead of std::string, this will break a few programs in very minor ways, a few seconds each to fix, I'd say. --- src/unit/fstring.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/unit') diff --git a/src/unit/fstring.cpp b/src/unit/fstring.cpp index 462ce5e..2044a86 100644 --- a/src/unit/fstring.cpp +++ b/src/unit/fstring.cpp @@ -10,6 +10,7 @@ public: addTest( Unit::compare1 ); addTest( Unit::compare2 ); addTest( Unit::appendSingle ); + addTest( Unit::shared1 ); } virtual ~Unit() @@ -36,6 +37,18 @@ public: for( char l = 'a'; l < 'g'; l++ ) b += l; unitTest( b == "abcdef" ); + unitTest( strcmp( b.getStr(), "abcdef" ) == 0 ); + } + + void shared1() + { + Bu::FString a("Hey there"); + Bu::FString b( a ); + unitTest( a.getStr() == b.getStr() ); + b += " guy"; + unitTest( a.getStr() != b.getStr() ); + a = b; + unitTest( a.getStr() == b.getStr() ); } }; -- cgit v1.2.3