Skip to content

Instantly share code, notes, and snippets.

@typester
Created December 24, 2008 01:54
Show Gist options
  • Save typester/39556 to your computer and use it in GitHub Desktop.
Save typester/39556 to your computer and use it in GitHub Desktop.
#!perl
use strict;
use Test::More tests => 4;
BEGIN { use_ok("Text::AutoLink") }
my $original = <<EOS;
<html><body><a href="http://search.cpan.org">http://search.cpan.org</a></body></html>
EOS
my $auto = Text::AutoLink->new;
my $text = $auto->parse_string($original);
is($original, $text);
$original = <<EOS;
<html><body>http://search.cpan.org</a></body></html>
EOS
$text = $auto->parse_string($original);
is($text, <<EOS);
<html><body><a href="http://search.cpan.org">http://search.cpan.org</a></body></html>
EOS
$original = <<EOS;
<html><body>http://search.cpan.org<strong>hoge</strong></body></html>
EOS
$text = $auto->parse_string($original);
is($text, <<EOS);
<html><body><a href="http://search.cpan.org">http://search.cpan.org</a><strong>hoge</strong></body></html>
EOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment