diff options
author | dakkar <dakkar@luxion> | 2005-11-05 11:06:09 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2005-11-05 11:06:09 +0000 |
commit | da1d1cf0604da05f253d3e59c11eb92db5833244 (patch) | |
tree | cf70e9d377d131a78d3c0cf4fa1c98d32e026e47 /t/01-config.t | |
parent | spostata eccezione di file not found, cambiati i 'die' con Exception::Class, ... (diff) | |
download | WebCoso-da1d1cf0604da05f253d3e59c11eb92db5833244.tar.gz WebCoso-da1d1cf0604da05f253d3e59c11eb92db5833244.tar.bz2 WebCoso-da1d1cf0604da05f253d3e59c11eb92db5833244.zip |
normalizzati i nomi dei metodi, aggiunti test per controllo duplicati
git-svn-id: svn://luxion/repos/WebCoso/trunk@20 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 't/01-config.t')
-rw-r--r-- | t/01-config.t | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/t/01-config.t b/t/01-config.t index d4c8e85..b0261df 100644 --- a/t/01-config.t +++ b/t/01-config.t @@ -22,14 +22,14 @@ is(scalar @resources,1,'una risorsa definta'); isa_ok($resources[0],'WebCoso::Config::Resource'); is_deeply( - [$resources[0]->axes()], + [$resources[0]->get_axes()], ['filename'], 'un solo asse'); is_deeply( - [$resources[0]->axis('filename')], + [$resources[0]->get_axis_value('filename')], ["$thisdir/src/file1.rest.txt"], 'filename'); -is($resources[0]->datastream(filename=>"$thisdir/src/file1.rest.txt"), +is($resources[0]->get_datastream(filename=>"$thisdir/src/file1.rest.txt"), <<'EOF',''); Titolo ====== @@ -37,11 +37,11 @@ Titolo testo EOF is_deeply( - [$resources[0]->properties()], + [$resources[0]->get_properties()], [], 'no properties'); is_deeply( - [$resources[0]->collections()], + [$resources[0]->get_collections()], [], 'no collections'); } @@ -79,22 +79,22 @@ my @collections=$collections->get_all_collections(); is(scalar @collections,1,'una collezione'); is_deeply( - [$collections[0]->axes()], + [$collections[0]->get_axes()], ['language'], 'multilingua'); is_deeply( - [$collections[0]->axis('language')], + [$collections[0]->get_axis_value('language')], [], 'ma nessuna definita'); is_deeply( - [$collections->axes()], + [$collections->get_axes()], ['language'], 'multilingua, insieme'); is_deeply( - [$collections->axis('language')], + [$collections->get_axis_value('language')], [], 'ma nessuna definita, insieme'); -my $props=$collections[0]->properties(language=>''); +my $props=$collections[0]->get_properties(language=>''); isa_ok($props,'HASH'); is_deeply( $props, @@ -142,23 +142,23 @@ is(scalar @collections,2,'due collezioni'); # definizione. Forse non sarĂ sempre vero is_deeply( - [sort $collections[0]->axis('language')], + [sort $collections[0]->get_axis_value('language')], ['en', 'it'], 'due lingue'); is_deeply( - [sort $collections->axis('language')], + [sort $collections->get_axis_value('language')], ['en', 'it'], 'due lingue'); is( - $collections[0]->properties(language=>'en')->{name}, + $collections[0]->get_properties(language=>'en')->{name}, 'coll1-en', 'nome en'); is( - $collections[0]->properties(language=>'it')->{name}, + $collections[0]->get_properties(language=>'it')->{name}, 'coll1', 'nome it'); is( - $collections[1]->properties(language=>'it')->{name}, + $collections[1]->get_properties(language=>'it')->{name}, 'coll2', 'nome default'); @@ -249,7 +249,7 @@ my @collections=$collections->get_all_collections(); is(scalar @resources,1,'una risorsa'); is(scalar @collections,1,'una collezione'); is_deeply( - [$resources[0]->collections()], + [$resources[0]->get_collections()], [$collections[0]], 'aggancio r->c'); is_deeply( @@ -257,3 +257,38 @@ is_deeply( [$resources[0]], 'aggancio c->r'); } + +WebCoso::Config->clear(); + +{ +my $conf_file=<<'EOF'; +$r1=res('src/file1.rest.txt','Id','dst/file.html'); +$c1=coll('coll1'); +$c2=coll('coll2'); +$c1->add_res($r1); +$r1->add_coll($c1); +$c2->add_res($r1); +EOF + +ok(WebCoso::Config->read_scalar($conf_file,"$thisdir/config-in-test"), + 'eseguita la configurazione (no strict)'); + +my @resources=WebCoso::Config->get_all_resources(); +my $collections=WebCoso::Config->get_collections(); +my @collections=$collections->get_all_collections(); + +is(scalar @resources,1,'una risorsa'); +is(scalar @collections,2,'due collezioni'); +is_deeply( + [sort $resources[0]->get_collections()], + [sort $collections[0],$collections[1]], + 'aggancio r->c'); +is_deeply( + [$collections[0]->get_resources()], + [$resources[0]], + 'aggancio c->r'); +is_deeply( + [$collections[1]->get_resources()], + [$resources[0]], + 'aggancio c->r'); +} |