aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2007-09-08 10:50:54 +0000
committerdakkar <dakkar@luxion>2007-09-08 10:50:54 +0000
commit496ddccead787a78c88aef90467fb8f7d141e7c7 (patch)
treea23efef72b5e2de94915a6e8e16f2bb97b96f1e6 /t
parentadded writers (diff)
downloadWebCoso-496ddccead787a78c88aef90467fb8f7d141e7c7.tar.gz
WebCoso-496ddccead787a78c88aef90467fb8f7d141e7c7.tar.bz2
WebCoso-496ddccead787a78c88aef90467fb8f7d141e7c7.zip
cache is now updated on 'put'
git-svn-id: svn://luxion/repos/WebCoso/trunk@283 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 't')
-rw-r--r--t/fcp-01.t8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/fcp-01.t b/t/fcp-01.t
index 4d52258..a745de2 100644
--- a/t/fcp-01.t
+++ b/t/fcp-01.t
@@ -14,6 +14,7 @@ $fc->add_parser(qr{\.t$} => sub { $calls{t}++;return ['t',@_] });
$fc->add_parser(qr{\.pm$} => sub { $calls{pm}++;return ['pm',@_] });
$fc->add_writer(qr{\.stuff$} => sub { $calls{stuff}++;
print {file($_[0])->openw} "gino\n",$_[1]; });
+$fc->add_parser(qr{\.stuff$} => sub { $calls{rstuff}++; return 'bad'});
my $base=file(__FILE__)->parent->parent;
@@ -53,9 +54,14 @@ my $wr_contents="something\nor\nother\n";
$fc->put($wr_file->stringify,$wr_contents);
is($calls{stuff},1,'called ok 3');
is($wr_file->slurp,"gino\n$wr_contents",'written ok');
+is($fc->get($wr_file->stringify),$wr_contents,'read back from cache');
+ok(! exists $calls{rstuff},'no reader call');
+
$fc->put($wr_file->stringify,$wr_contents.2);
is($calls{stuff},2,'no caching on write');
is($wr_file->slurp,"gino\n${wr_contents}2",'written ok 2');
+is($fc->get($wr_file->stringify),$wr_contents.2,'cache updated');
+ok(! exists $calls{rstuff},'no reader call');
}
{
@@ -79,4 +85,6 @@ my $wr_contents={good=>'stuff'};
$fc->put($wr_file->stringify,$wr_contents);
is($calls{stuff},3,'called ok 4');
is($wr_file->slurp,"gino\n${wr_contents}",'written ok 3 (ref)');
+is_deeply($fc->get($wr_file->stringify),$wr_contents,'no stringification');
+ok(! exists $calls{rstuff},'no reader call');
}