Passing text input to a test

The RunTest application allows you to pass information into a test. Use the TTextArgumentDictionary class to parse the inputs to the test.

TTextArgumentDictionary takes arguments from the command and creates an ordered collection of TText objects from the input. TTextArgumentDictionary forms key-value pairs from the input. All key and value objects are a concrete derived class of TText.

A leading hyphen character identifies keywords. Anything without a leading hyphen is a value argument. A keyword picks up the following argument if it is not another keyword. This example shows how TTextArgumentDictionary parses the command-line input to a test to create the key-value pairs.

Command-line input:

    -parm -n sample1 Jim Tom -ccc 84 85
This table lists the options defined for the example:

Key Value Description
-parm The value associated with -parm is an empty TText, not NIL. This allows you to distinguish "There is no -parm keyword" from "There is a -parm argument with no associated value."
-n sample1 The -n argument picks up the following argument, sample1, as its value.
1 Jim There is no associated keyword, so "Jim" is assigned key "1". The key
is a TText object, not a numeric value.
2 Tom There is no associated keyword, so "Tom" is assigned key "2". The key is a TText object, not a numeric value.
-ccc 84 The -ccc argument picks up the following argument, 84, as its value.
3 85 There is no associated keyword, so "85" is assigned key "3". The key is a TText object, not a numeric value.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker