use strict; use warnings; use Test::Base; use WWW::Prefetcher; plan tests => 1 * blocks(); my $base = 'http://agentzh.org/misc/blog.js'; run { my $block = shift; my $name = $block->name; my $content = $block->content; my $res = WWW::Prefetcher::extract_css(\$content, \$base, $block->type); is join("\n", @$res) . "\n", $block->links, "$name - links ok"; }; __DATA__ === TEST 1: --- type: css --- content @import url(s5-core.css); /* required to make the slide show run at all */ body { color: red; } @import url(../framing.css); /* sets basic placement and size of slide components */ @import url(pretty.css); /* stuff that makes the slides look better than blah */ --- links http://agentzh.org/misc/s5-core.css http://agentzh.org/framing.css http://agentzh.org/misc/pretty.css === TEST 2: url("...") --- type: css --- content @import url("http://commons.apache.org/style/commons-maven.css"); --- links http://commons.apache.org/style/commons-maven.css === TEST 3: url("...") with spaces --- type: css --- content @import url ( " http://commons.apache.org/style/commons-maven.css " ) ; --- links http://commons.apache.org/style/commons-maven.css === TEST 4: url('...') --- type: css --- content @import url('http://commons.apache.org/style/commons-maven.css'); --- links http://commons.apache.org/style/commons-maven.css === TEST 5: url('...') with spaces --- type: css --- content @import url ( ' http://commons.apache.org/style/commons-maven.css ' ) ; --- links http://commons.apache.org/style/commons-maven.css === TEST 6: "..." --- type: css --- content @import "common.css"; --- links http://agentzh.org/misc/common.css === TEST 7: "..." --- type: css --- content @import url("/stylesheets/schema_browser/bar.css"); --- links http://agentzh.org/stylesheets/schema_browser/bar.css === TEST 8: media --- type: css --- content @import url("tiger.css") screen,projection; --- links http://agentzh.org/misc/tiger.css === TEST 9: media --- type: css --- content @import url(resource://gre/res/html.css); @import url(chrome://global/content/xul.css); @import url(resource://gre/res/quirk.css); --- links resource://gre/res/html.css chrome://global/content/xul.css resource://gre/res/quirk.css === TEST 10: media --- type: css --- content @import url(import.css?delay=1); --- links http://agentzh.org/misc/import.css?delay=1 === TEST 11: html links --- type: html --- content