aboutsummaryrefslogtreecommitdiff
path: root/t/01-config.t
blob: f14f6c91de4df8ce717d066369497bbf8e1b6284 (plain)
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
#!/usr/bin/perl 
use strict;
use warnings;
use Path::Class;
use Test::More 'no_plan';
 
my $thisdir=file($0)->parent->absolute;
 
BEGIN { use_ok('WebCoso::Config'); }
 
my $conf_file=<<'EOF';
res('src/file1.rest.txt','Id','dst/file.html');
EOF
 
ok(WebCoso::Config->read_scalar($conf_file,"$thisdir/config-in-test"),'eseguita la configurazione');
 
my @resources=WebCoso::Config->get_all_resources();
is(scalar @resources,1,'una risorsa definta');
 
isa_ok($resources[0],'WebCoso::Config::Resource');
is_deeply(
    [$resources[0]->axes()],
    ['filename'],
    'un solo asse');
is_deeply(
    [$resources[0]->axis('filename')],
    ["$thisdir/src/file1.rest.txt"],
    'filename');
is($resources[0]->datastream(filename=>"$thisdir/src/file1.rest.txt"),
   <<'EOF','');
Titolo
======
 
testo
EOF
is_deeply(
    [$resources[0]->properties()],
    [],
    'no properties');
is_deeply(
    [$resources[0]->collections()],
    [],
    'no collections');