aboutsummaryrefslogtreecommitdiff
path: root/src/unit
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-12-29 21:33:08 +0000
committerMike Buland <eichlan@xagasoft.com>2008-12-29 21:33:08 +0000
commitf461b3c1839e5cfc85685ed1cb828ecaa74d6912 (patch)
tree5b04dabaea17632ba7c8ab448c9472ecfdaf765e /src/unit
parentfc9da0992217c7d593ad97d2f338850b40cbaaec (diff)
downloadlibbu++-f461b3c1839e5cfc85685ed1cb828ecaa74d6912.tar.gz
libbu++-f461b3c1839e5cfc85685ed1cb828ecaa74d6912.tar.bz2
libbu++-f461b3c1839e5cfc85685ed1cb828ecaa74d6912.tar.xz
libbu++-f461b3c1839e5cfc85685ed1cb828ecaa74d6912.zip
Fixed some horror inside the Taf writer. It had a strange corner case when
adding a property to a group that had a name but an empty value. Also added a isEmpty() function to Bu::FString, finally.
Diffstat (limited to 'src/unit')
-rw-r--r--src/unit/taf.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/unit/taf.cpp b/src/unit/taf.cpp
index 0813444..3bf7cc6 100644
--- a/src/unit/taf.cpp
+++ b/src/unit/taf.cpp
@@ -21,7 +21,8 @@ public:
21 { 21 {
22 setName("taf"); 22 setName("taf");
23 addTest( Unit::read1 ); 23 addTest( Unit::read1 );
24 addTest( Unit::encode ); 24 addTest( Unit::encode1 );
25 addTest( Unit::emptyStr1 );
25 } 26 }
26 27
27 virtual ~Unit() 28 virtual ~Unit()
@@ -50,7 +51,7 @@ public:
50#undef FN_TMP 51#undef FN_TMP
51 } 52 }
52 53
53 void encode() 54 void encode1()
54 { 55 {
55 Bu::MemBuf mb; 56 Bu::MemBuf mb;
56 Bu::TafWriter tw( mb ); 57 Bu::TafWriter tw( mb );
@@ -93,6 +94,20 @@ public:
93 unitTest( rg->getProperty("Encoded") == sData ); 94 unitTest( rg->getProperty("Encoded") == sData );
94 delete rg; 95 delete rg;
95 } 96 }
97
98 void emptyStr1()
99 {
100 Bu::MemBuf mb;
101 Bu::TafWriter tw( mb );
102
103 Bu::TafGroup g("Test Group");
104 Bu::FString sVal;
105 g.addChild( new Bu::TafProperty("Lame", sVal) );
106 tw.writeGroup( &g );
107
108 unitTest(
109 mb.getString() == "{\"Test Group\":\n \"Lame\"=\"\"\n}\n" );
110 }
96}; 111};
97 112
98int main( int argc, char *argv[] ) 113int main( int argc, char *argv[] )