File: 50-multiple-files.t

package info (click to toggle)
libhtml-lint-perl 2.32%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 356 kB
  • sloc: perl: 1,739; makefile: 6
file content (66 lines) | stat: -rw-r--r-- 1,403 bytes parent folder | download | duplicates (2)
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
#!perl

use warnings;
use strict;

use lib 't/';
use Util;

my @files = _get_paragraphed_files();

checkit( [
    [ 'elem-unopened' => qr/<\/p> with no opening <P>/i ],

    [ 'elem-unclosed' => qr/\Q<b> at (6:12) is never closed/i ],
    [ 'elem-unclosed' => qr/\Q<i> at (7:12) is never closed/i ],

    [ 'elem-unopened' => qr/<\/b> with no opening <B>/i ],
], @files );

# Read in a set of sets of lines, where each "file" is separated by a
# blank line in <DATA>
sub _get_paragraphed_files {
    local $/ = '';

    my @sets;

    while ( my $paragraph = <DATA> ) {
        my @lines = split /\n/, $paragraph;
        @lines = map { "$_\n" } @lines;
        push( @sets, [@lines] );
    }

    return @sets;
}


__DATA__
<HTML> <!-- for elem-unopened -->
    <HEAD>
        <TITLE>Test stuff</TITLE>
    </HEAD>
    <BODY BGCOLOR="white">
        This is my paragraph</P>
    </BODY>
</HTML>

<HTML>
    <HEAD> <!-- Checking for elem-unclosed -->
        <TITLE>Test stuff</TITLE>
    </HEAD>
    <BODY BGCOLOR="white">
        <P><B>This is my paragraph</P>
        <P><I>This is another paragraph</P>
    </BODY>
</HTML>

<!-- based on doc-tag-required -->
<HTML>
    <HEAD>
        <TITLE>Test stuff</TITLE>
    </HEAD>
    <BODY BGCOLOR="white">
        </B>Gratuitous unnecessary closing tag that does NOT match to the opening [B] above.
        <P>This is my paragraph</P>
    </BODY>
</HTML>