aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2007-08-13 13:39:41 +0000
committerdakkar <dakkar@luxion>2007-08-13 13:39:41 +0000
commit1a33e97c0208c53a1e3ecc11e72a288bdba97840 (patch)
treefc481d391a7ae9adc46162d9fe916c0735957c7b /t
parentora sta in Text::Restructured::Writer::LibXML (diff)
downloadWebCoso-1a33e97c0208c53a1e3ecc11e72a288bdba97840.tar.gz
WebCoso-1a33e97c0208c53a1e3ecc11e72a288bdba97840.tar.bz2
WebCoso-1a33e97c0208c53a1e3ecc11e72a288bdba97840.zip
inizio moduli di supporto: il parser trasparente
git-svn-id: svn://luxion/repos/WebCoso/trunk@269 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 't')
-rw-r--r--t/fcp-01.t29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/fcp-01.t b/t/fcp-01.t
new file mode 100644
index 0000000..c14028b
--- /dev/null
+++ b/t/fcp-01.t
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More qw(no_plan);
+use Path::Class;
+
+BEGIN { use_ok('File::Cache::Parsed') or die }
+
+my $fc=File::Cache::Parsed->new();
+my %calls;
+$fc->add_parser(qr{\.t$} => sub { $calls{t}++;return ['t',@_] });
+$fc->add_parser(qr{\.pm$} => sub { $calls{pm}++;return ['pm',@_] });
+
+my $base=file(__FILE__)->parent->parent;
+my $module_file=$base->file('lib','File','Cache','Parsed.pm');
+my $module_contents=$module_file->slurp;
+my $test_file=$base->file('t','fcp-01.t');
+my $test_contents=$test_file->slurp;
+
+is_deeply($fc->get($module_file->stringify),
+ ['pm',$module_file->stringify,$module_contents]);
+is_deeply($fc->get($test_file->stringify),
+ ['t',$test_file->stringify,$test_contents]);
+is($calls{t},1);
+is($calls{pm},1);
+is_deeply($fc->get($test_file->stringify),
+ ['t',$test_file->stringify,$test_contents]);
+is($calls{t},1);
+is($calls{pm},1);