summaryrefslogtreecommitdiff
path: root/t/tests/webcoso.t
diff options
context:
space:
mode:
Diffstat (limited to 't/tests/webcoso.t')
-rw-r--r--t/tests/webcoso.t45
1 files changed, 35 insertions, 10 deletions
diff --git a/t/tests/webcoso.t b/t/tests/webcoso.t
index a68d6d2..6712eff 100644
--- a/t/tests/webcoso.t
+++ b/t/tests/webcoso.t
@@ -6,7 +6,15 @@ use WebCoso;
sub cmp-files($a,$b,$msg) {
ok(
($a.defined and $b.defined and $a.keys eqv $b.keys and
- [and] map { $a{$_}.abspath eq $b{$_}.abspath }, $a.keys),
+ [and] map {
+ my $cmp = $b{$_};
+ if $cmp ~~ Callable {
+ $cmp.($a{$_})
+ }
+ else {
+ $a{$_}.abspath eq $cmp.abspath
+ }
+ }, $a.keys),
$msg,
);
}
@@ -25,15 +33,32 @@ $one.child('document.en.txt').spurt('foo');
my $wc = WebCoso.new(:$srcdir,:$destdir);
-my %one = $wc.get-files('one','document','txt');
+subtest {
+ 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',
-);
+ cmp-files(
+ %one,
+ {
+ it => $one.child('document.it.txt'),
+ en => $one.child('document.en.txt'),
+ },
+ 'get-files works',
+ );
+}, 'getting files';
+
+subtest {
+ $wc.put-file('two','document','en','txt',
+ 'something');
+ my %two = $wc.get-files('two','document','txt');
+
+ cmp-files(
+ %two,
+ {
+ en => { $^f.abspath ~~ /two\/document\.en\.txt$/ },
+ },
+ 'put-file works',
+ );
+
+}, 'putting files';
done-testing;