diff options
Diffstat (limited to 't/fcp-01.t')
-rw-r--r-- | t/fcp-01.t | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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'); } |