File: issue-3.t

package info (click to toggle)
libcatmandu-rdf-perl 0.32-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 220 kB
  • sloc: perl: 469; sh: 4; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 737 bytes parent folder | download | duplicates (4)
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
use strict;
use warnings;
use Test::More;

use Catmandu::Exporter::RDF;

my $turtle;
my $exporter = Catmandu::Exporter::RDF->new(file => \$turtle, type => 'ttl');

my @arefs = (
    {
        "http://x.org/alice" => { "foaf_knows" => "<http://x.org/bob>" },
        "http://x.org/bob" => { "a" => "foaf_Person", }
    },
    { 
        "http://x.org/alice" => { "foaf_knows" => "<http://x.org/claire>" }, 
    }
);

$exporter->add($_) for @arefs;
$exporter->commit;

$turtle =~ s/ \./ ;/smg;
is_deeply [ sort split "\n", $turtle ], [
    '<http://x.org/alice> <http://xmlns.com/foaf/0.1/knows> <http://x.org/bob>, <http://x.org/claire> ;',
    '<http://x.org/bob> a <http://xmlns.com/foaf/0.1/Person> ;'
];
print $turtle;

done_testing;