aboutsummaryrefslogtreecommitdiff
path: root/src/unit
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/unit/variant.unit27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/unit/variant.unit b/src/unit/variant.unit
index 1654c4f..4fd5e26 100644
--- a/src/unit/variant.unit
+++ b/src/unit/variant.unit
@@ -10,6 +10,18 @@
10#include "bu/membuf.h" 10#include "bu/membuf.h"
11#include "bu/formatter.h" 11#include "bu/formatter.h"
12#include "bu/string.h" 12#include "bu/string.h"
13#include "bu/sio.h"
14
15using namespace Bu;
16
17Bu::String mkastring()
18{
19 Bu::String a = "s";
20 a += "tu";
21 a += "f";
22 a += "f";
23 return a;
24}
13 25
14suite Variant 26suite Variant
15{ 27{
@@ -29,6 +41,21 @@ suite Variant
29 Bu::Formatter f( mb ); 41 Bu::Formatter f( mb );
30 f << v; 42 f << v;
31 unitTest( mb.getString() == v.get<Bu::String>() ); 43 unitTest( mb.getString() == v.get<Bu::String>() );
44 }
32 45
46 test stringForamtting
47 {
48 Bu::String s1;
49 s1 = "hello";
50 int32_t i1, i2;
51 i1 = 32;
52 i2 = 0;
53 Bu::String out = Bu::String("%1-%2-%3-%4.odp").
54 arg( s1.getStr() ).
55 arg( mkastring().getStr() ).
56 arg( i1, Fmt(2).fill('0') ).
57 arg( i2, Fmt(2).fill('0') );
58 sio << sio.nl << out << sio.nl;
59 unitTest( out == "hello-stuff-32-00.odp" );
33 } 60 }
34} 61}