SYNOPSIS

  use Test::XML::SAX tests => 1;
  use My::XML::Filter;

  my $handler = My::XML::Filter->new;
  test_sax( $handler, '<foo />', '<bar/>', 'translates foo to bar' );

  # ... In Another File ...

  use Test::XML::SAX; use My::XML::Filter;

  sub do_tests {
      my $handler = My::XML::Filter->new;
      test_sax( $handler, '<foo />', '<bar/>', 'translates foo to bar' );
  }

  test_all_sax_parsers( \&do_tests, 1 );

DESCRIPTION

This module is for testing \s-1XML::SAX\s0 handlers.

FUNCTIONS

All functions are exported.

test_sax ( \s-1HANDLER\s0, \s-1INPUT\s0, \s-1EXPECTED\s0 [, \s-1TESTNAME\s0 ] )

This function will process \s-1INPUT\s0 using \s-1HANDLER\s0, and compare the result with \s-1EXPECTED\s0. \s-1TESTNAME\s0 can optionally be used to name the test in the output (a good idea).

test_all_sax_parsers ( \s-1SUB\s0 [, \s-1NUMTESTS\s0 ] )

This function will repeat a set of tests for all installed \s-1SAX\s0 parsers. \s-1SUB\s0 must be a coderef to run a series of tests. \s-1NUMTESTS\s0 is the number of tests inside \s-1SUB\s0. \s-1NB\s0: You must not issue a plan to Test::More if you call this function! The plan will be set for you, according to the number of parsers installed and \s-1NUMTESTS\s0. This also means that you must not have any tests outside of \s-1SUB\s0 or you will get an error. When \s-1SUB\s0 is called, it will be passed two arguments. The name of the parser being used and the number of tests. It can use this information to decide whether or not to skip this set of tests.

RELATED TO Test::XML::SAX…

Test::More, Test::XML, \s-1XML::SAX\s0.

AUTHOR

Dominic Mitchell, <cpan2 (at) semantico.com>

COPYRIGHT AND LICENSE

Copyright 2002 by semantico

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