File: 15rellicense.t

package info (click to toggle)
libhtml-microformats-perl 0.105-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 1,340 kB
  • sloc: perl: 14,121; makefile: 10; sh: 1
file content (49 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download | duplicates (5)
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
use Test::More tests => 8;
use HTML::Microformats;

my $html = <<'HTML';
<html lang=en>
	<a rel="license" href="l" title="License"><span class="value">Lic</span>ense</a>
HTML

my $document = HTML::Microformats->new_document($html, 'http://example.com/');
$document->assume_all_profiles;

my ($l) = $document->objects('RelLicense');

is($l->get_href,
	'http://example.com/l',
	'License URI correct.');

is($l->get_title,
	'License',
	'License title correct');

is($l->get_label,
	'Lic',
	'License label correct');
	
my $model = $document->model;

foreach my $uri (qw(http://creativecommons.org/ns#license
	http://www.w3.org/1999/xhtml/vocab#license
	http://purl.org/dc/terms/license))
{
	ok($model->count_statements(
			RDF::Trine::Node::Resource->new('http://example.com/'),
			RDF::Trine::Node::Resource->new($uri),
			RDF::Trine::Node::Resource->new('http://example.com/l')),
		"RDF Predicate <$uri> set");
}

ok($model->count_statements(
		RDF::Trine::Node::Resource->new('http://example.com/'),
		RDF::Trine::Node::Resource->new('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
		RDF::Trine::Node::Resource->new('http://creativecommons.org/ns#Work')),
	"cc:Work set");

ok($model->count_statements(
		RDF::Trine::Node::Resource->new('http://example.com/l'),
		RDF::Trine::Node::Resource->new('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
		RDF::Trine::Node::Resource->new('http://creativecommons.org/ns#License')),
	"cc:License set");