summaryrefslogtreecommitdiff
path: root/t/largetags.t
blob: a9ed3ff69ee607dfb3d8ece9a107f97a3805ceef (plain)
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
# Exercise the tokenpos buffer allocation routines by feeding it
# very large tags.

use Test::More tests => 2;

use strict;
use HTML::Parser ();

my $p = HTML::Parser->new(api_version => 3);

$p->handler("start" =>
	    sub {
		my $tp = shift;
		#diag int(@$tp), " - ", join(", ", @$tp);
		is(@$tp, 2 + 26 * 6 * 4);
	    }, "tokenpos");

$p->handler("declaration" =>
	    sub {
		my $t = shift;
		#diag int(@$t), " - @$t";
		is(@$t, 26 * 6 * 2 + 1);
	    }, "tokens");

$p->parse("<a ");
for ("aa" .. "fz") {
    $p->parse("$_=1 ");
}
$p->parse(">");

$p->parse("<!DOCTYPE ");
for ("aa" .. "fz") {
    $p->parse("$_ -- $_ -- ");
}
$p->parse(">");
$p->eof;
exit;