#!/usr/bin/perl
BEGIN {
$| = 1;
$^W = 1;
}
SCOPE: {
my
$tracker
= HTML::TrackerLink->new();
ok(
defined
$tracker
,
"->new() returns defined"
);
ok(
$tracker
,
"->new() returns true"
);
isa_ok(
$tracker
,
'HTML::TrackerLink'
);
}
SCOPE: {
my
$tracker
= HTML::TrackerLink->new(
foo
=>
$url1
,
bar
=>
$url2
);
isa_ok(
$tracker
,
'HTML::TrackerLink'
);
$_
=
'this'
;
my
$html1
=
$tracker
->process(
'A foo #1234 bug'
);
'Multiple named trackers links correctly'
);
is(
$_
,
'this'
,
'->process does not clobber $_'
);
is(
$tracker
->
default
(
$url3
),
$url3
,
'Set default tracker'
);
$html1
=
$tracker
->process(
'A foo #1234 bug'
);
'Multiple named trackers links correctly'
);
my
$html2
=
$tracker
->process(
'A #1234 bug'
);
'Default tracker links correctly'
);
}
SCOPE: {
my
$linker
= HTML::TrackerLink->new();
$linker
->default_keyword(
'bug'
);
isa_ok(
$linker
,
'HTML::TrackerLink'
);
my
$string1
=
'This is #3'
;
my
$html1
=
$linker
->process(
$string1
);
ok(
$html1
,
"process ok"
);
"HTML created OK"
);
my
$string2
=
<<'END_STRING';
This is a message containing links to #456 and BuG 1234 and #456.
Also to change #2345 and to #543 as well.
END_STRING
my
$html2
=
$linker
->process(
$string2
);
is(
$html2
,
<<'END_HTML', 'All three match types occured in one string' );
END_HTML
}