aboutsummaryrefslogtreecommitdiff
path: root/src/unit/fstring.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-08-14 14:37:22 +0000
committerMike Buland <eichlan@xagasoft.com>2007-08-14 14:37:22 +0000
commitf1d6b50ac5a014a5cd87a605bd4f4e1e6342ef7d (patch)
treeba8615da5a64ea173001156a74fb1903ed6da9c6 /src/unit/fstring.cpp
parentcd0fef04fab0229ac9bb332806342fd8ee3c8673 (diff)
downloadlibbu++-f1d6b50ac5a014a5cd87a605bd4f4e1e6342ef7d.tar.gz
libbu++-f1d6b50ac5a014a5cd87a605bd4f4e1e6342ef7d.tar.bz2
libbu++-f1d6b50ac5a014a5cd87a605bd4f4e1e6342ef7d.tar.xz
libbu++-f1d6b50ac5a014a5cd87a605bd4f4e1e6342ef7d.zip
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.
Diffstat (limited to '')
-rw-r--r--src/unit/fstring.cpp13
1 files changed, 13 insertions, 0 deletions
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:
10 addTest( Unit::compare1 ); 10 addTest( Unit::compare1 );
11 addTest( Unit::compare2 ); 11 addTest( Unit::compare2 );
12 addTest( Unit::appendSingle ); 12 addTest( Unit::appendSingle );
13 addTest( Unit::shared1 );
13 } 14 }
14 15
15 virtual ~Unit() 16 virtual ~Unit()
@@ -36,6 +37,18 @@ public:
36 for( char l = 'a'; l < 'g'; l++ ) 37 for( char l = 'a'; l < 'g'; l++ )
37 b += l; 38 b += l;
38 unitTest( b == "abcdef" ); 39 unitTest( b == "abcdef" );
40 unitTest( strcmp( b.getStr(), "abcdef" ) == 0 );
41 }
42
43 void shared1()
44 {
45 Bu::FString a("Hey there");
46 Bu::FString b( a );
47 unitTest( a.getStr() == b.getStr() );
48 b += " guy";
49 unitTest( a.getStr() != b.getStr() );
50 a = b;
51 unitTest( a.getStr() == b.getStr() );
39 } 52 }
40}; 53};
41 54