X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=urisagit%2FPerl-Docs.git;a=blobdiff_plain;f=t%2Fstringify.t;fp=t%2Fstringify.t;h=0000000000000000000000000000000000000000;hp=c3809cb753bf42af19f022e13c0f0b66197239d4;hb=47f1263f57592cfd836dee694c227575bc9cde46;hpb=cf83821d2b095a464d353ea98e41bfa8b262caef diff --git a/t/stringify.t b/t/stringify.t deleted file mode 100644 index c3809cb..0000000 --- a/t/stringify.t +++ /dev/null @@ -1,45 +0,0 @@ -#!perl -T - -use strict; - -use Test::More; -use File::Slurp; -use IO::Handle ; -use UNIVERSAL ; - -plan tests => 3 ; - -my $path = "data.txt"; -my $data = "random junk\n"; - -# create an object with an overloaded path - -my $obj = FileObject->new( $path ) ; - -isa_ok( $obj, 'FileObject' ) ; -is( "$obj", $path, "object stringifies to path" ); - -write_file( $obj, $data ) ; - -my $read_text = read_file( $obj ) ; -is( $data, $read_text, 'read_file of stringified object' ) ; - -unlink $path ; - -exit ; - -# this code creates the object which has a stringified path - -package FileObject; - -use overload - q[""] => \&stringify, - fallback => 1 ; - -sub new { - return bless { path => $_[1] }, $_[0] -} - -sub stringify { - return $_[0]->{path} -}