This file is indexed.

/usr/share/perl5/XML/Compile/Tester.pod is in libxml-compile-tester-perl 0.90-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
=head1 NAME

XML::Compile::Tester - support XML::Compile related regression testing

=head1 INHERITANCE

 XML::Compile::Tester
   is a Exporter

=head1 SYNOPSIS

 use XML::Compile::Tester;

 # default additional compile flags, avoids repetition
 set_compile_defaults(validation => 0, @other_opts);
 set_compile_defaults();  # reset

 # set default namespace, such that $type only needs to use local
 my $ns     = 'some-schemas-targetNamespace';
 my $type   = pack_type($ns, 'localName'); # X::C::Util
 set_default_namespace($ns);
 my $type   = 'localName'; # now implicit in $ns

 my $reader = reader_create($schema, "my reader", $type, @opts);
 my $data   = $reader->($xml);  # $xml is string, filename, node

 my $writer = writer_create($schema, "my writer", $type, @opts);
 my $xml    = $writer->($doc, $data);
 my $xml    = writer_test($writer, $data);

 my $rerror = reader_error($schema, $type, $xml);
 my $werror = writer_error($schema, $type, $data);

 my $output = templ_xml($schema, $type, @options);
 my $output = templ_perl($schema, $type, @options);

=head1 DESCRIPTION

The XML::Compile module suite has extensive regression testing.  Probably,
you want to do regression testing as well.  This module provide functions
which simplify writing tests for XML::Compile related distributions.

=head1 FUNCTIONS

=head2 Reader checks

=over 4

=item B<reader_create>(SCHEMA, COMMENT, TYPE, OPTIONS)

Create a reader for TYPE.  One test is created, reporting
success or failure of the creation.

Of course, XML::Compile::Schema subroutine compile is being called, with some
options.  By default, C<check_values> is true, and C<include_namespaces>
is false.  These values can be overruled using L<set_compile_defaults()|XML::Compile::Tester/"Helpers">,
and with the OPTIONS parameter list.

example: reader_create

 my $type   = pack_type('namespace', 'localName');
 my $reader = reader_create($schema, 'my test', $type
   , check_occurs => 0, @other_options);

 my $data   = $reader->($xml);
 is_deeply($data, $expected, 'my test');  # Test::More
 cmp_deeply($data, $expected, 'my test'); # Test::Deep

 # alternative for $type:
 set_default_namespace('namespace');
 my $reader = reader_create($schema, 'my test', 'localName'
   , check_occurs => 0, @other_options);

=item B<reader_error>(SCHEMA, TYPE, XML)

Parsing the XML to interpret the TYPE should return an error.  The
error text is returned.

example: reader_error

 my $error = reader_error($schema, $type, <<_XML);
 <test1>...</test1>
 _XML

 is($error, 'error text', 'my test');
 like($error, qr/error pattern/, 'my test');

=back

=head2 Writer checks

=over 4

=item B<writer_create>(SCHEMA, COMMENT, TYPE, OPTIONS)

Create a writer for TYPE.  One test (in the Test::More sense) is created,
reporting success or failure of the creation.

Of course, XML::Compile::Schema subroutine compile is being called, with some
options.  By default, C<check_values> and C<use_default_namespace> are true,
and C<include_namespaces> is false.  These values can be overruled using
L<set_compile_defaults()|XML::Compile::Tester/"Helpers">, and with the OPTIONS parameter list.

example: writer_create

 set_default_namespace('namespace');
 my $writer = writer_create($schema, 'my test', 'test1');

 my $doc    = XML::LibXML::Document->new('1.0', 'UTF-8');
 my $xml    = $writer->($doc, $data);
 compare_xml($xml, <<_EXPECTED, 'my test');
   <test1>...</test1>
 _EXPECTED

 # implicit creation of $doc
 my $xml    = writer_test($writer, $data);

=item B<writer_error>(SCHEMA, TYPE, DATA)

Translating the Perl DATA into the XML type should return a validation
error, which is returned.

example: writer_error

 my $error = writer_error($schema, $type, $data);

 is($error, 'error text', 'my test');
 like($error, qr/error pattern/, 'my test');

=item B<writer_test>(WRITER, DATA, [DOC])

Run the test with a compiled WRITER, which was created with L<writer_create()|XML::Compile::Tester/"Writer checks">.
When no DOC (XML::LibXML::Document object) was specified, then one will
be created for you.

=back

=head2 Check templates

=over 4

=item B<templ_perl>(SCHEMA, TYPE, OPTIONS)

=item B<templ_xml>(SCHEMA, TYPE, OPTIONS)

Create an example template for TYPE, as XML message.
The OPTIONS are passed to XML::Compile::Schema subroutine template.

example: templ_xml

 my $out = templ_xml($schema, $type, show => 'ALL');
 is($out, $expected);

=back

=head2 Helpers

=over 4

=item B<compare_xml>(XML, EXPECTED, [COMMENT])

Compare the XML (either a string or an XML::LibXML::Element) with
the EXPECTED string.  Both sources are stripped from layout before
comparing.

In a future release, this algorithm will get improved to compare
the parsed XML node trees, not the strings.

example: compare_xml

 compare_xml($xml, <<_XML, 'my test');
   <test1>...</test1>
 _XML

=item B<set_compile_defaults>(OPTIONS)

Each call to create a reader or writer (also indirectly) with
XML::Compile::Schema subroutine compile will get these OPTIONS passed, on top
(and overruling) the usual settings.

example: 

 # defaults for XML::Compile::Schema::compile()
 set_compile_defaults(include_namespaces => 1, validate => 0
   , sloppy_intergers => 1, sloppy_floats => 1);

 set_compile_defaults();   # reset

=item B<set_default_namespace>(TESTNS)

Defined which namespace to use when a relative (only localName) type
is provided.  By default, this is C<undef> (an error when used)

=back

=head1 SEE ALSO

This module is part of XML-Compile-Tester distribution version 0.90,
built on August 16, 2012. Website: F<http://perl.overmeer.net/xml-compile/>

Other distributions in this suite:
L<XML::Compile>,
L<XML::Compile::SOAP>,
L<XML::Compile::SOAP12>,
L<XML::Compile::SOAP::Daemon>,
L<XML::Compile::SOAP::WSA>,
L<XML::Compile::C14N>,
L<XML::Compile::WSS>,
L<XML::Compile::Tester>,
L<XML::Compile::Cache>,
L<XML::Compile::Dumper>,
L<XML::Compile::RPC>,
L<XML::Rewrite>,
L<XML::eXistDB>,
and
L<XML::LibXML::Simple>.

Please post questions or ideas to the mailinglist at
F<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile>
For live contact with other developers, visit the C<#xml-compile> channel
on C<irc.perl.org>.

=head1 LICENSE

Copyrights 2008-2012 by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>