aboutsummaryrefslogtreecommitdiff
path: root/t/04-resource.t
diff options
context:
space:
mode:
Diffstat (limited to 't/04-resource.t')
-rw-r--r--t/04-resource.t13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/04-resource.t b/t/04-resource.t
index 05fd5b6..99e7cf3 100644
--- a/t/04-resource.t
+++ b/t/04-resource.t
@@ -10,25 +10,32 @@ my $r=WebCoso::Resource->new();
isa_ok($r,'WebCoso::Resource');
+is_deeply([$r->get_axes()],[],'no axes');
+
$r->set_property(prop1=>'value1');
is($r->get_property('prop1'),'value1','simple global');
is($r->get_property({},'prop1'),'value1','explicit global');
is($r->get_property({a1=>1,a2=>3},'prop1'),'value1','over global');
+is_deeply([$r->get_axes()],[],'no axes');
$r->set_property(prop1=>'value2');
is($r->get_property('prop1'),'value2','simple global redef');
is($r->get_property({},'prop1'),'value2','explicit global redef');
is($r->get_property({a1=>1,a2=>3},'prop1'),'value2','over global redef');
+is_deeply([$r->get_axes()],[],'no axes');
$r->set_property({},prop1=>'value3');
is($r->get_property('prop1'),'value3','simple global redef');
is($r->get_property({},'prop1'),'value3','explicit global redef');
is($r->get_property({a1=>1,a2=>3},'prop1'),'value3','over global redef');
+is_deeply([$r->get_axes()],[],'no axes');
$r->set_property({a1=>3},prop2=>'v1');
ok(! defined $r->get_property('prop2'),'undef on generalization');
is($r->get_property({a1=>3},'prop2'),'v1','specific');
is($r->get_property({a1=>3,a2=>3},'prop2'),'v1','over specific');
+is_deeply([$r->get_axes()],['a1'],'1 axis');
+is_deeply([$r->get_axis_values('a1')],[3],'1 axis, 1 value');
$r->set_property({a1=>2},prop2=>'v2');
ok(! defined $r->get_property('prop2'),'undef on generalization');
@@ -36,6 +43,12 @@ is($r->get_property({a1=>3},'prop2'),'v1','specific, oldval');
is($r->get_property({a1=>3,a2=>3},'prop2'),'v1','over specific, oldval');
is($r->get_property({a1=>2},'prop2'),'v2','specific, newval');
is($r->get_property({a1=>2,a2=>3},'prop2'),'v2','over specific, newval');
+is_deeply([$r->get_axes()],['a1'],'1 axis');
+is_deeply([sort $r->get_axis_values('a1')],[2,3],'1 axis, 2 values');
$r->set_property({a1=>1,a2=>2},prop3=>'vx');
ok(! defined $r->get_property({a1=>1},'prop3'),'undef on generalization, 2');
+is_deeply([sort $r->get_axes()],['a1','a2'],'2 axes');
+is_deeply([sort $r->get_axis_values('a1')],[1,2,3],'1st axis, 3 values');
+is_deeply([sort $r->get_axis_values('a2')],[2],'2nd axis, 1 value');
+