aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2005-10-19 09:58:36 +0000
committerdakkar <dakkar@luxion>2005-10-19 09:58:36 +0000
commit4db992c02a87a8416d8ac3abd389e979d6444e54 (patch)
tree3a9f150c2283c4b2c7944987a33ef1fa7b3f2493 /t
parentAggiunta supporto iniziale Collections (diff)
downloadWebCoso-4db992c02a87a8416d8ac3abd389e979d6444e54.tar.gz
WebCoso-4db992c02a87a8416d8ac3abd389e979d6444e54.tar.bz2
WebCoso-4db992c02a87a8416d8ac3abd389e979d6444e54.zip
aggiunto il supporto per i nomi delle collezioni
git-svn-id: svn://luxion/repos/WebCoso/trunk@5 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 't')
-rw-r--r--t/01-config.t59
1 files changed, 52 insertions, 7 deletions
diff --git a/t/01-config.t b/t/01-config.t
index 6ae9fce..c10dad6 100644
--- a/t/01-config.t
+++ b/t/01-config.t
@@ -14,7 +14,8 @@ my $conf_file=<<'EOF';
res('src/file1.rest.txt','Id','dst/file.html');
EOF
-ok(WebCoso::Config->read_scalar($conf_file,"$thisdir/config-in-test"),'eseguita la configurazione');
+ok(WebCoso::Config->read_scalar($conf_file,"$thisdir/config-in-test"),
+ 'eseguita la configurazione');
my @resources=WebCoso::Config->get_all_resources();
is(scalar @resources,1,'una risorsa definta');
@@ -53,7 +54,8 @@ my $conf_file=<<'EOF';
res('src/file1.rest.txt','src/nonce.rest.txt','Id','dst/file.html');
EOF
-ok(WebCoso::Config->read_scalar($conf_file,"$thisdir/config-in-test"),'eseguita la configurazione');
+ok(WebCoso::Config->read_scalar($conf_file,"$thisdir/config-in-test"),
+ 'eseguita la configurazione');
my @resources=WebCoso::Config->get_all_resources();
is(scalar @resources,1,'una risorsa definta');
@@ -62,9 +64,11 @@ is_deeply(
[$resources[0]->axis('filename')],
["$thisdir/src/file1.rest.txt", "$thisdir/src/nonce.rest.txt"],
'filenames');
-dies_ok {$resources[0]->datastream(filename=>"$thisdir/src/nonce.rest.txt")} 'muore se non trova il file';
-
-
+dies_ok
+ {
+ $resources[0]->datastream(filename=>"$thisdir/src/nonce.rest.txt")
+ }
+ 'muore se non trova il file';
}
WebCoso::Config->clear();
@@ -74,13 +78,54 @@ my $conf_file=<<'EOF';
coll('coll1');
EOF
-ok(WebCoso::Config->read_scalar($conf_file,"$thisdir/config-in-test"),'eseguita la configurazione');
+ok(WebCoso::Config->read_scalar($conf_file,"$thisdir/config-in-test"),
+ 'eseguita la configurazione');
is(scalar WebCoso::Config->get_all_resources(),0,'nessuna risorsa');
my @collections=WebCoso::Config->get_all_collections();
-
is(scalar @collections,1,'una collezione');
+is_deeply(
+ [$collections[0]->axes()],
+ ['language'],
+ 'multilingua');
+is_deeply(
+ [$collections[0]->axis('language')],
+ [''],
+ 'ma nessuna definita');
+my $props=$collections[0]->properties(language=>'');
+isa_ok($props,'HASH');
+is_deeply(
+ $props,
+ {name=>'coll1'},
+ 'solo il nome');
+}
+
+WebCoso::Config->clear();
+{
+my $conf_file=<<'EOF';
+my $c1=coll({it=>'coll1',en=>'coll1-en'});
+coll('coll2',[$c1]);
+EOF
+
+ok(WebCoso::Config->read_scalar($conf_file,"$thisdir/config-in-test"),
+ 'eseguita la configurazione');
+
+my @collections=WebCoso::Config->get_all_collections();
+is(scalar @collections,2,'due collezioni');
+
+is_deeply(
+ [sort $collections[0]->axis('language')],
+ ['en', 'it'],
+ 'due lingue');
+is(
+ $collections[0]->properties(language=>'en')->{name},
+ 'coll1-en',
+ 'nome en');
+is(
+ $collections[0]->properties(language=>'it')->{name},
+ 'coll1',
+ 'nome it');
}