diff options
Diffstat (limited to 't/04-resource.t')
-rw-r--r-- | t/04-resource.t | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/t/04-resource.t b/t/04-resource.t index 99e7cf3..808629f 100644 --- a/t/04-resource.t +++ b/t/04-resource.t @@ -52,3 +52,33 @@ 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'); +# test sui vari get_property_* + +$r=WebCoso::Resource->new(); + +{ +open my $fh,'<',__FILE__; +$r->set_property(fh=>$fh); +} +{ +my $fh=$r->get_property_fh('fh'); +is((scalar <$fh>),"#!/usr/bin/perl\n",'legge fh'); +} +{ +my $content=$r->get_property_string('fh'); +like($content,qr{^#!/usr/bin/perl\n},'legge string'); +} + +$r->set_property(fh=> + sub { + open my $fh,'<',__FILE__; + return $fh; + }); +{ +my $fh=$r->get_property_fh('fh'); +is((scalar <$fh>),"#!/usr/bin/perl\n",'legge fh lazy'); +} +{ +my $content=$r->get_property_string('fh'); +like($content,qr{^#!/usr/bin/perl\n},'legge string lazy'); +} |