File: maint.t

package info (click to toggle)
libtest-xml-perl 0.08-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 160 kB
  • sloc: perl: 351; makefile: 2
file content (65 lines) | stat: -rw-r--r-- 1,682 bytes parent folder | download | duplicates (6)
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
# @(#) $Id$

use strict;
use warnings;

use Test::More;

BEGIN {
    foreach (qw( Test::Builder::Tester XML::SAX XML::Twig ) ) {
        eval "use $_";
        plan skip_all => "$_ not present" if $@;
    }
}

use Test::XML;

plan tests => 4;

#---------------------------------------------------------------------

test_out( "ok 1" );
is_xml( '<foo/>', '<foo/>' );
test_test( 'is_xml() spots same bits of xml' );

#---------------------------------------------------------------------

{
    local $TODO = "buggery uppage";
    test_out( "not ok 1" );
    test_fail( +2 );
    test_diag( "Found 2 differences:", "  Child element 'foo' missing from element ''.", "  Rogue element 'bar' in element ''." );
    is_xml( '<foo/>', '<bar/>' );
    test_test( 'is_xml() spots different bits of xml' );
}

#---------------------------------------------------------------------

{
    local $TODO = "buggery uppage";
    test_out( "not ok 1" );
    test_fail( +2 );
    test_diag( "During compare:", "not well-formed (invalid token) at line 1, column 1, byte 1" );
    is_xml( '</>', '<foo/>' );
    test_test( 'is_xml() whinges about broken source xml' );
}

#---------------------------------------------------------------------

{
    local $TODO = "buggery uppage";
    test_out( "not ok 1" );
    test_fail( +2 );
    test_diag( "During compare:", "no element found at line 1, column 0, byte -1" );
    is_xml( '<foo/>', '' );
    test_test( 'is_xml() whinges about broken dest xml' );
}

#---------------------------------------------------------------------

# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# indent-tabs-mode: nil
# End:
# vim: set ai et sw=4 syntax=perl :