Frederick Hirsch > FormatNroff-0.11 > HTML::Testing

Download:
FormatNroff-0.11.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

HTML::Testing - Test module to make test files simpler.

SYNOPSIS ^

A test file, simple.t may be created as follows:

 print "1..1\n";
 use strict;

 require HTML::FormatNroff;
 use HTML::Parse;
 require HTML::Testing;

 my $man_date = '20 Dec 97';
 my $name = "simple";

 my $html_source =<<END_INPUT;
 <HTML>
 <BODY>This is the body.</BODY>
 </HTML>
 END_INPUT

 my $expected = ".TH \"$name\" \"1\" \"$man_date\" \"FormatNroff\"  \n";  
 $expected .=<<END_EXPECTED;
 .PP
 This is the body.
 END_EXPECTED

 my $tester = new HTML::Testing(name => $name,
                                man_date => $man_date,
                                project => 'FormatNroff',
                                man_header => 1,
                                expected => $expected,
                                html_source => $html_source
                                output => 'TestOutput',
                                );
 $tester->run_test();
 1;

DESCRIPTION ^

Running the test harness with this will result in the creation of the files simple_expected.out, simple_actual.out and an html file corresponding to the html_source (simple.html). In addition, the test will return 'ok' if they are the same, and 'not ok' if not.

If the attribute html_file is specified, then html will be sourced from that file instead of html_source, and no html file will be created.

$testing = new HTML::Testing();

Create new test.

$testing->directory($value);

Set the directory for output (HTML, actual and expected output files) to $value.

$testing->run_test();

Run the test.

COPYRIGHT ^

Copyright (c) 1997 Frederick Hirsch. All rights reserved.

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

AUTHOR ^

Frederick Hirsch <f.hirsch@opengroup.org>

syntax highlighting: