summaryrefslogtreecommitdiff
path: root/src/tests/optparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tests/optparser.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/tests/optparser.cpp b/src/tests/optparser.cpp
index 9168af8..ee2ea58 100644
--- a/src/tests/optparser.cpp
+++ b/src/tests/optparser.cpp
@@ -8,13 +8,30 @@ public:
8 Opts() : 8 Opts() :
9 iBob( 542 ) 9 iBob( 542 )
10 { 10 {
11 callback( this, &Opts::cb ); 11 Option o;
12 o.sUsed = slot( this, &Opts::cb );
13 o.cOpt = 'x';
14 o.sOpt = "things";
15 o.bShortHasParams = true;
16 o.sHelp = "This is the first test parameter. It calls a function, and takes parameters.";
17 addOption( o );
18
19 Option o2;
20 o2.sUsed = slot( this, &Opts::cb );
21 o2.cOpt = 'y';
22 o2.sOpt = "stuff";
23 o2.bShortHasParams = false;
24 o2.sHelp = "This is the second test parameter. It does not take parameters. However, I do want to make this part much longer to see how it looks when you add way too much text to one of these things. It can't really be that bad, right?";
25 addOption( o2 );
26
27 addHelpOption('h', "help", "This help.");
12 } 28 }
13 29
14 int cb( int argc, char *argv[] ) 30 int cb( StrArray aParams )
15 { 31 {
16 sio << "Hey, cb was called, here's a class var: " << iBob << sio.nl; 32 sio << "Hey, cb was called, here's a class var: " << iBob << sio.nl;
17 return 5; 33 sio << "argv[] = " << aParams << sio.nl;
34 return 1;
18 } 35 }
19 36
20 int iBob; 37 int iBob;
@@ -23,5 +40,7 @@ public:
23int main( int argc, char *argv[] ) 40int main( int argc, char *argv[] )
24{ 41{
25 Opts o; 42 Opts o;
43
44 o.parse( argc, argv );
26} 45}
27 46