/usr/share/perl5/Test/RDF/DOAP/Version.pm is in libtest-rdf-doap-version-perl 0.010-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | package Test::RDF::DOAP::Version;
use 5.010;
use strict;
use utf8;
use RDF::Trine qw[iri variable literal blank statement];
use RDF::TrineX::Parser::Pretdsl;
use Test::More;
use URI::Escape qw[uri_escape];
use URI::file;
our $VERSION = '0.010';
our @EXPORT = qw(doap_version_ok);
our $DOAP = RDF::Trine::Namespace->new('http://usefulinc.com/ns/doap#');
use base qw[Exporter];
sub doap_version_ok
{
my ($dist, $module) = @_;
($module = $dist) =~ s{-}{::}g unless $module;
eval "use $module";
my $version = $module->VERSION;
my $dist_uri = iri(sprintf('http://purl.org/NET/cpan-uri/dist/%s/project', uri_escape($dist)));
my $model = RDF::Trine::Model->temporary_model;
my $turtle = RDF::Trine::Parser->new('Turtle');
while (<meta/*.{ttl,turtle,nt}>)
{
my $iri = URI::file->new_abs($_);
$turtle->parse_file_into_model("$iri", $_, $model);
}
my $rdfxml = RDF::Trine::Parser->new('RDFXML');
while (<meta/*.{rdf,rdfxml,rdfx}>)
{
my $iri = URI::file->new_abs($_);
$rdfxml->parse_file_into_model("$iri", $_, $model);
}
my $pretdsl = RDF::TrineX::Parser::Pretdsl->new;
while (<meta/*.{pret,pretdsl}>)
{
my $iri = URI::file->new_abs($_);
$pretdsl->parse_file_into_model("$iri", $_, $model);
}
my $pattern = RDF::Trine::Pattern->new(
statement($dist_uri, $DOAP->release, variable('v')),
statement(variable('v'), $DOAP->revision, literal($version, undef, 'http://www.w3.org/2001/XMLSchema#string')),
);
my $iter = $model->get_pattern($pattern);
while (my $result = $iter->next)
{
pass('doap_version_ok');
return 1;
}
$pattern = RDF::Trine::Pattern->new(
statement($dist_uri, $DOAP->release, variable('v')),
statement(variable('v'), $DOAP->revision, literal($version//'0')),
);
$iter = $model->get_pattern($pattern);
while (my $result = $iter->next)
{
pass('doap_version_ok');
return 1;
}
diag("${module}->VERSION = $version");
$pattern = RDF::Trine::Pattern->new(
statement($dist_uri, $DOAP->release, variable('v')),
statement(variable('v'), $DOAP->revision, variable('r')),
);
$iter = $model->get_pattern($pattern);
my $found = 0;
while (my $result = $iter->next)
{
diag("Found metadata for: ".$result->as_string);
$found++;
}
diag("Found no metadata for any versions.") unless $found;
fail('doap_version_ok');
return 0;
}
1;
__END__
=pod
=encoding utf-8
=for stopwords ver xsd:string
=head1 NAME
Test::RDF::DOAP::Version - tests 'meta/changes.ttl' is up to date
=head1 DESCRIPTION
=over
=item C<< doap_version_ok($dist, $module) >>
Reads all RDF in a distribution's "meta" directory and checks the
distribution metadata matches the pattern:
?uri doap:release ?rel .
?rel doap:revision ?ver .
Where ?uri is the URI C<< http://purl.org/NET/cpan-uri/dist/$dist/project >>
and ?ver is C<< $module->VERSION >>, as an xsd:string or plain literal.
=back
=head1 BUGS
Please report any bugs to
L<http://rt.cpan.org/Dist/Display.html?Queue=Test-RDF-DOAP-Version>.
=head1 SEE ALSO
L<Module::Install::DOAPChangeSets>.
=head1 AUTHOR
Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2011-2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|