Specify the arguments after the -o
option as in this command line:
RunTest -t TSampleObjectKeylessTest SampleObjectTestLib -o roz jim
1 void TSampleObjectKeylessTest::Setup() 2 { 3 TTextArgumentDictionary args(*this); 4 5 args.RemoveOnLookup(true); 6 7 fTextOption = args.NthValue(1);// First nonkeyed argument, required. 8 if (fTextOption == NIL) { 9 OutputTextStream() << "No options specified. Must provide a value.\n"; 10 SetSuccess(false); 11 } 12 13 fSecondTextOption = args.NthValue(2); // Second nonkeyed argument, not required 14 if (fSecondTextOption == NIL) { 15 fSecondTextOption = new (TAllocationHeap(this)) TStandardText ("BLANK"); 16 OutputTextStream() << "No options specified. Using default value: " << fSecondTextOption << " .\n"; 17 }
Line number 13 assigns the value of the second argument to the appropriate variable. In this example, if the argument is not provided, the function assigns the variable a default value.