summaryrefslogtreecommitdiff
path: root/t/tests/webcoso.t
blob: a68d6d26a34de2be321da9a9cc906e325e65e226 (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
# -*- mode: perl6 -*- 
use Test;
use File::Temp;
use WebCoso;
 
sub cmp-files($a,$b,$msg) {
    ok(
        ($a.defined and $b.defined and $a.keys eqv $b.keys and
         [andmap { $a{$_}.abspath eq $b{$_}.abspath }, $a.keys),
        $msg,
    );
}
 
my $testdir = tempdir.IO;
my $srcdir = $testdir.child('src');
my $destdir = $testdir.child('dst');
 
my $one = $srcdir.child('one');
 
$one.mkdir;
$destdir.mkdir;
 
$one.child('document.it.txt').spurt('foo');
$one.child('document.en.txt').spurt('foo');
 
my $wc = WebCoso.new(:$srcdir,:$destdir);
 
my %one = $wc.get-files('one','document','txt');
 
cmp-files(
    %one,
    {
        it => $one.child('document.it.txt'),
        en => $one.child('document.en.txt'),
    },
    'get-files works',
);
 
done-testing;