1Test::XML::SAX(3) User Contributed Perl Documentation Test::XML::SAX(3)
2
3
4
6 Test::XML::SAX - Test XML::SAX handlers
7
9 use Test::XML::SAX tests => 1;
10 use My::XML::Filter;
11
12 my $handler = My::XML::Filter->new;
13 test_sax( $handler, '<foo />', '<bar/>', 'translates foo to bar' );
14
15 # ... In Another File ...
16
17 use Test::XML::SAX; use My::XML::Filter;
18
19 sub do_tests {
20 my $handler = My::XML::Filter->new;
21 test_sax( $handler, '<foo />', '<bar/>', 'translates foo to bar' );
22 }
23
24 test_all_sax_parsers( \&do_tests, 1 );
25
27 This module is for testing XML::SAX handlers.
28
30 All functions are exported.
31
32 test_sax ( HANDLER, INPUT, EXPECTED [, TESTNAME ] )
33 This function will process INPUT using HANDLER, and compare the
34 result with EXPECTED. TESTNAME can optionally be used to name the
35 test in the output (a good idea).
36
37 test_all_sax_parsers ( SUB [, NUMTESTS ] )
38 This function will repeat a set of tests for all installed SAX
39 parsers. SUB must be a coderef to run a series of tests. NUMTESTS
40 is the number of tests inside SUB.
41
42 NB: You must not issue a plan to Test::More if you call this
43 function! The plan will be set for you, according to the number of
44 parsers installed and NUMTESTS. This also means that you must not
45 have any tests outside of SUB or you will get an error.
46
47 When SUB is called, it will be passed two arguments. The name of
48 the parser being used and the number of tests. It can use this
49 information to decide whether or not to skip this set of tests.
50
52 Test::More, Test::XML, XML::SAX.
53
55 Dominic Mitchell, <cpan2 (at) semantico.com>
56
58 Copyright 2002 by semantico
59
60 This library is free software; you can redistribute it and/or modify it
61 under the same terms as Perl itself.
62
63
64
65perl v5.38.0 2023-07-21 Test::XML::SAX(3)