From 496ddccead787a78c88aef90467fb8f7d141e7c7 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 8 Sep 2007 10:50:54 +0000 Subject: cache is now updated on 'put' git-svn-id: svn://luxion/repos/WebCoso/trunk@283 fcb26f47-9200-0410-b104-b98ab5b095f3 --- t/fcp-01.t | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't') 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'); } -- cgit v1.2.3