diff options
author | dakkar <dakkar@thenautilus.net> | 2015-09-05 16:21:29 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2015-09-05 16:21:29 +0100 |
commit | 4078424b9105dba16c50087347b3a607cd75d4d1 (patch) | |
tree | bd81983e27be76dcb28254f26c5359be47a8aa8d /t | |
parent | more tests (diff) | |
download | WebCoso-p6-4078424b9105dba16c50087347b3a607cd75d4d1.tar.gz WebCoso-p6-4078424b9105dba16c50087347b3a607cd75d4d1.tar.bz2 WebCoso-p6-4078424b9105dba16c50087347b3a607cd75d4d1.zip |
first maker test
Diffstat (limited to 't')
-rw-r--r-- | t/lib/Test/WebCoso.pm | 19 | ||||
-rw-r--r-- | t/tests/maker.t | 34 | ||||
-rw-r--r-- | t/tests/webcoso.t | 18 |
3 files changed, 55 insertions, 16 deletions
diff --git a/t/lib/Test/WebCoso.pm b/t/lib/Test/WebCoso.pm new file mode 100644 index 0000000..1f54c92 --- /dev/null +++ b/t/lib/Test/WebCoso.pm @@ -0,0 +1,19 @@ +# -*- mode: perl6 -*- +unit module Test::WebCoso; +use Test; + +sub cmp-files($a,$b,$msg) is export { + ok( + ($a.defined and $b.defined and $a.keys eqv $b.keys and + [and] map { + my $cmp = $b{$_}; + if $cmp ~~ Callable { + $cmp.($a{$_}) + } + else { + $a{$_}.abspath eq $cmp.abspath + } + }, $a.keys), + $msg, + ); +} diff --git a/t/tests/maker.t b/t/tests/maker.t new file mode 100644 index 0000000..38fbfd8 --- /dev/null +++ b/t/tests/maker.t @@ -0,0 +1,34 @@ +# -*- mode: perl6 -*- +use Test; +use lib 't/lib'; +use Test::WebCoso; +use File::Temp; +use WebCoso; +use WebCoso::Maker::TT; + +my $testdir = tempdir.IO; +my $srcdir = $testdir.child('src'); +my $destdir = $testdir.child('dst'); + +$srcdir.mkdir; +$destdir.mkdir; + +$srcdir.child('document.it.tt').spurt('it'); +$srcdir.child('document.en.tt').spurt('en'); + +my $wc = WebCoso.new(:$srcdir,:$destdir); + +my $m = WebCoso::Maker::TT.new(basename=>'document',dir=>Nil,:$wc); + +my %output = $m.get-files(); + +cmp-files( + %output, + { + en => { $^x.slurp eq 'en expanded' }, + it => { $^x.slurp eq 'it expanded' }, + }, + 'made the files', +); + +done-testing; diff --git a/t/tests/webcoso.t b/t/tests/webcoso.t index 6712eff..6676ded 100644 --- a/t/tests/webcoso.t +++ b/t/tests/webcoso.t @@ -2,22 +2,8 @@ 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 - [and] map { - my $cmp = $b{$_}; - if $cmp ~~ Callable { - $cmp.($a{$_}) - } - else { - $a{$_}.abspath eq $cmp.abspath - } - }, $a.keys), - $msg, - ); -} +use lib 't/lib'; +use Test::WebCoso; my $testdir = tempdir.IO; my $srcdir = $testdir.child('src'); |