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 39
|
use strict;
use warnings;
use Test::More;
use App::rdfns;
sub test_run {
my ($argv, $expect, $msg) = @_;
my $out;
local *STDOUT;
open STDOUT, '>', \$out;
App::rdfns->new->run(@$argv);
close STDOUT;
is $out, (@$expect ? join("\n", @$expect, '') : undef), $msg;
}
test_run ["geo"] => ['http://www.opengis.net/ont/geosparql#'],
"look up URI";
test_run ['wgs.prefix'] => ["pos"],
"normalize prefix";
test_run ['xsd,foaf.json'] => ['"foaf": "http://xmlns.com/foaf/0.1/",
"xsd": "http://www.w3.org/2001/XMLSchema#"'],
"JSON (multiple prefixes)";
test_run ['http://www.opengis.net/ont/geosparql#'] => ["geo"],
"look up prefix of a namespace";
test_run ['http://notanamespace.foo/'] => [],
"unknown namespace";
test_run ['http://purl.org/dc/elements/1.1/title'] => ["dc:title"],
"qname";
test_run ['http://purl.org/dc/elements/1.1/:'] => [],
"invalid local name";
test_run ['20140901','dblp','20140831','dblp'] => [
"http://dblp.l3s.de/d2r/page/authors/\n".
"http://www4.wiwiss.fu-berlin.de/dblp/terms.rdf#" ],
"select version";
done_testing;
|