HeaderDoc::Test
IntroductionTest framework for parser and C preprocessor tests. DiscussionThe Member Functions
_initializeInitializes an instance of a sub _initialize ParametersconvertToHashConverts an array alternating between keys and values (one per line) to a hash. sub convertToHash ParameterscppTestsGrabs the C preprocessor info from the block parser
and stores the results in the sub cppTests ParametersDiscussionIf any CPP hash changes occur as a result of parsing this declaration, they are captured by this code. dbprintPrints a sub dbprint ParametersdumpObjNamesGrabs the HeaderDoc object names resulting from
parsing this declaration and stores the results
in the sub dumpObjNames ParametersDiscussionThis includes the important keys from the HeaderDoc API objects. It does not attempt to include every possible key. filterResultsFilters out bits of the test results for comparison purposes. sub filterResults multiPrintPrints both the expected and actual values as-is. sub multiPrint ParametersnewCreates a new sub new ParametersobjCmpCompares two object dumps. sub objCmp ParametersDiscussionTakes the output of an object (key-value pairs) and displays the keys that are different, missing, or added in the actual results. readFromFileLoads this instance from a test file. sub readFromFile ParametersrunTestRuns this test. sub runTest ParametersReturn ValueReturns 0 on success, 1 if the test fails. runtest_subRuns this test in the specified mode. sub runtest_sub ParametersReturn ValueReturns 0 on success, 1 if the test fails. showresultsCompares actual results with expected. sub showresults Parameters
showresults_subCompares actual results with expected in a given mode. sub showresults_sub ParameterssinglePrintShows the individual lines in two arrays that difer. sub singlePrint ParametersstarboxPrints an explanatory message in a box of asterisks. sub starbox ParameterssupportsAllDecsReturns whether this sub supportsAllDecs ParameterswriteToFileWrites a freeze-dried copy of this instance to a test file. sub writeToFile ParameterswriteToPlistWrites tests to a property list file. Currently disabled. sub writeToPlist Member Data
CODEThe actual code to parse. $self->{CODE}
COMMENTThe HeaderDoc comment block associated with this test. Used only for parser tests. Empty for C preprocessor tests. $self->{COMMENT}
CPPCODEThe C preprocessor macros to parse; used to modify
the declaration in $self->{CPPCODE}
EXPECTED_FILTERED_RESULTA filtered copy of the expected result after applying a series of regular expressions to ignore parts of the results. Used for simplifying comparison when a particular type of change is expected. This is temporary data that should never be serialized to disk. $self->{EXPECTED_FILTERED_RESULT}
EXPECTED_FILTERED_RESULT_ALLDECSA filtered copy of the expected "all declarations" result after applying a series of regular expressions to ignore parts of the results. Used for simplifying comparison when a particular type of change is expected. This is temporary data that should never be serialized to disk. $self->{EXPECTED_FILTERED_RESULT_ALLDECS}
EXPECTED_RESULTThe expected test results. During test creation, this is
filled in by running the test once, ignoring the test
failure, and copying the obtained results into this field
from $self->{EXPECTED_RESULT}
EXPECTED_RESULT_ALLDECSThe expected test results. During test creation, this is
filled in by running the test once, ignoring the test
failure, and copying the obtained results into this field
from $self->{EXPECTED_RESULT_ALLDECS}
FAILMSGA message to display if the test fails. This can be used to provide additional information about what functionality the test covers. $self->{FAILMSG}
FILENAMEFilename for this test. Derived from $self->{FILENAME}
FILTERED_RESULTA filtered copy of the actual result after applying a series of regular expressions to ignore parts of the results. Used for simplifying comparison when a particular type of change is expected. This is temporary data that should never be serialized to disk. $self->{FILTERED_RESULT}
FILTERED_RESULT_ALLDECSA filtered copy of the actual "all declarations" result after applying a series of regular expressions to ignore parts of the results. Used for simplifying comparison when a particular type of change is expected. This is temporary data that should never be serialized to disk. $self->{FILTERED_RESULT_ALLDECS}
HeaderDoc::running_testSet to 1 if HeaderDoc is currently running a test, else 0. $HeaderDoc::running_test = 0; DiscussionDisables lots of warnings caused by imperfect test data while the tests are running. HeaderDoc::Test::VERSIONThe revision control revision number for this module. $HeaderDoc::Test::VERSION = '$Revision: 1334261201 $'; DiscussionIn the git repository, contains the number of seconds since January 1, 1970. HeaderDoc::test_alldecsEnables "all decs" support in the test module. $HeaderDoc::test_alldecs = 0; # Here, there be dragons. DiscussionFor now, this should be zero. In addition to some languages being ostensibly "supported" by alldecs but not being perfectly supported in that mode (Perl, Pascal), there's also the problem of a bunch of tests whose results change radically that I just don't have time to hand-verify. (TODO: DAG: FIXME) Also, there are tests that probably will have to be significantly modified because declarations that are not currently being parsed will suddenly get parsed, resulting in lots of apple_ref conflicts and other such madness. In short, it's a major effort that will have to wait a bit. LANGThe programming language for the test. $self->{LANG}
NAMEName of this test. $self->{NAME}
RESULTThe actual test results. Filled in automatically
by $self->{RESULT}
RESULT_ALLDECSThe actual test results for "all declarations" mode (equivalent to
passing the $self->{RESULT_ALLDECS}
SUBLANGThe programming language variant for the test. Usually
same as the language, but may differ for languages built
on other languages, e.g. $self->{SUBLANG}
TYPEThe type of test. Currently either $self->{TYPE}
|