From 304d476fbe2f823fff8e35373b57361ee36de8e9 Mon Sep 17 00:00:00 2001 From: dakkar Date: Tue, 7 Feb 2006 16:03:34 +0000 Subject: aggiunte letture da fh, anche lazy git-svn-id: svn://luxion/repos/WebCoso/trunk@155 fcb26f47-9200-0410-b104-b98ab5b095f3 --- t/04-resource.t | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 't') 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'); +} -- cgit v1.2.3