4 use Test::More tests => 13;
6 BEGIN { use_ok("IkiWiki::Plugin::inline"); }
8 # Test the absolute_urls function, used to fix up relative urls for rss
14 $expected=~s/URL/$baseurl/g;
15 is(IkiWiki::absolute_urls($input, $baseurl), $expected);
16 # try it with single quoting -- it's ok if the result comes back
17 # double or single-quoted
19 my $expected_alt=$expected;
20 $expected_alt=~s/"/'/g;
21 my $ret=IkiWiki::absolute_urls($input, $baseurl);
22 ok(($ret eq $expected) || ($ret eq $expected_alt), "$ret vs $expected");
26 test($_[0], $_[1], $_[0]);
29 my $url="http://example.com/blog/foo/";
30 unchanged("foo", $url);
31 unchanged('<a href="http://other.com/bar.html">', $url, );
32 test('<a href="bar.html">', $url, '<a href="URLbar.html">');
33 test('<a href="/bar.html">', $url, '<a href="http://example.com/bar.html">');
34 test('<img src="bar.png" />', $url, '<img src="URLbar.png" />');
35 test('<img src="/bar.png" />', $url, '<img src="http://example.com/bar.png" />');
36 # off until bug #603736 is fixed
37 #test('<video controls src="bar.ogg">', $url, '<video controls src="URLbar.ogg">');