aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2005-11-05 15:11:33 +0000
committerdakkar <dakkar@luxion>2005-11-05 15:11:33 +0000
commit2fc2d3eb7edf6ac03b9506b719758e9e6f13c7d3 (patch)
tree7c7e1e6bf88f0aa59cbaf095f0f476aa2a6a851a /t
parentaggiunta gestione pipeline e test relativi (diff)
downloadWebCoso-2fc2d3eb7edf6ac03b9506b719758e9e6f13c7d3.tar.gz
WebCoso-2fc2d3eb7edf6ac03b9506b719758e9e6f13c7d3.tar.bz2
WebCoso-2fc2d3eb7edf6ac03b9506b719758e9e6f13c7d3.zip
migliorate le eccezioni, scritto Driver con test. Re #1
git-svn-id: svn://luxion/repos/WebCoso/trunk@22 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 't')
-rw-r--r--t/02-driver.t27
-rw-r--r--t/lib/WebCoso/Pipeline/Test.pm17
2 files changed, 44 insertions, 0 deletions
diff --git a/t/02-driver.t b/t/02-driver.t
new file mode 100644
index 0000000..444d5d6
--- /dev/null
+++ b/t/02-driver.t
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Path::Class;
+use Test::More 'no_plan';
+use Test::Exception;
+use lib 't/lib';
+use WebCoso::Config;
+
+my $thisdir=file($0)->parent->absolute;
+
+BEGIN { use_ok('WebCoso::Driver'); }
+
+my $conf_file=<<'EOF';
+res('src/file1.rest.txt','Test','dst/file.html');
+EOF
+
+WebCoso::Config->read_scalar($conf_file,"$thisdir/config-in-test");
+
+ok(WebCoso::Driver->run(), 'il driver va');
+
+my @calls=WebCoso::Pipeline::Test->get_calls();
+my @resources=WebCoso::Config->get_all_resources();
+is(scalar @calls,1,'una chiamata');
+is($calls[0]->{resource},
+ $resources[0],
+ 'alla risorsa giusta');
diff --git a/t/lib/WebCoso/Pipeline/Test.pm b/t/lib/WebCoso/Pipeline/Test.pm
new file mode 100644
index 0000000..239d74b
--- /dev/null
+++ b/t/lib/WebCoso/Pipeline/Test.pm
@@ -0,0 +1,17 @@
+package WebCoso::Pipeline::Test;
+use strict;
+use warnings;
+
+my @calls;
+
+sub process {
+ my ($class,$resource)=@_;
+ push @calls, { resource => $resource };
+ return 1;
+}
+
+sub get_calls {
+ return @calls;
+}
+
+1;