Doxygen::Test Class Reference

Test module, used only in Doxygen:: test files (.t files). More...

List of all members.

Public Member Functions

 new (%flags)
 Create new Doxygen::Text item.
 DESTROY ()
 Destructor for object.
 import (%flags)
 The import protocol for the package is used to setup conditions for testing.
 check ()
 Checks to see if the underlying Test::Builder has registered a failed test.
 comment ($match)
 Get generated comment starting with the specified match string.
 contains ($text, $name)
 Checks to see if the the generated text contains the specified text.
 like ($pattern, $name)
 Marks test based on the generated text matching the specified $pattern.
 ok ($test, $name)
 Marks test based on boolean test result $test.
 hasComment ($tag,@@matches)
 Checks if generated text contains comment beginning with specified $tag.
 hasMacro ()
 Checks if the redefinition-prevention macro is present in the file.
 includes ($path)
 Checks for a include for the specified path.
 nameSpace ($path)
 Check to see if specified namespace is defined.
 dumpGeneratedText ()
 Bail out of test, incidentally causing generated text to be dumped.

Detailed Description

Test module, used only in Doxygen:: test files (.t files).

SYNOPSIS

  use Doxygen::Test   path  => 'Filter.pm',
                      tests => 2;
  
  hasComment('\file Test.pm');
  hasMacro;

DESCRIPTION

This module exists only to support automated testing of the other Doxygen modules. It is used inside of t.# files instead of Test::Simple or Test::More.

In addition to specifying the number of tests, instantiation specifies a source file to be processed. This is done using the normal Doxygen::Source mechanism. The output is captured and stored in the object, so that subsequent like() calls can match against it.

SEE ALSO

DoxyFilt.pl

COPYRIGHT AND LICENSE

Copyright 2004-2010 by Marc M. Adkins

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Version:
'0.01'
Author:
Marc M. Adkins, mailto:Perl@Doorways.org

Definition at line 55 of file Test.pm.


Member Function Documentation

Doxygen::Test::check (  ) 

Checks to see if the underlying Test::Builder has registered a failed test.

Seems clumsy that we have call this after changing the test object. Sadly, the test object disappears before we get called in DESTROY. Thus we have to keep this updated the best we can.

Doxygen::Test::comment ( match  ) 

Get generated comment starting with the specified match string.

This allows pulling a specific comment from the generated text.

Comments are assumed to be in C++ multi-line format with a doubled asterisk on the opening of the comment:

Returns any subsequent matching text from the comment. The $match is a string, not a regular expression.

Doxygen::Test::contains ( text,
name 
)

Checks to see if the the generated text contains the specified text.

If the $name is not provided it is constructed.

Doxygen::Test::DESTROY (  ) 

Destructor for object.

Checks to see if all tests appear to have passed. If not, dumps generated text to STDERR.

Doxygen::Test::dumpGeneratedText (  ) 

Bail out of test, incidentally causing generated text to be dumped.

Doxygen::Test::hasComment ( tag,
@@  matches 
)

Checks if generated text contains comment beginning with specified $tag.

This would be something like "\\file Filter.pm".

If this is true and subsequent @matches are provided these will be tested against the body of the comment and the test will pass only if all of them match.

Note that for purposes of counting tests, this is one test for the $tag and one test for each of the @matches (may be zero).

Doxygen::Test::hasMacro (  ) 

Checks if the redefinition-prevention macro is present in the file.

This will look something like:

  #ifndef DoxyFilt
  #define DoxyFilt
  
  ...[snip]...
  
  #endif  DoxyFilt
Doxygen::Test::import ( flags  ) 

The import protocol for the package is used to setup conditions for testing.

Doxygen::Test::includes ( path  ) 

Checks for a include for the specified path.

Doxygen::Test::like ( pattern,
name 
)

Marks test based on the generated text matching the specified $pattern.

Much like Test::Simple::like(), with the text target pre-specified.

Doxygen::Test::nameSpace ( path  ) 

Check to see if specified namespace is defined.

Doxygen::Test::new ( flags  ) 

Create new Doxygen::Text item.

Not called directly, a global object is instantiated via the import() function.

Doxygen::Test::ok ( test,
name 
)

Marks test based on boolean test result $test.

Just like Test::Simple::ok().


The documentation for this class was generated from the following file: