File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ my $model = MetaCPAN::Web::Model::API::Module->new(api => 'http://example.com');
2020# $body
2121# $body, $type
2222sub get_raw {
23- $res_body = shift . ' ' ;
23+ $res_body = shift ;
2424 $content_type = shift if @_ ;
2525 my $res = $model -> source(qw( who cares ) )-> recv -> {raw };
2626 return $res ;
@@ -58,9 +58,26 @@ foreach my $ctype ( 'text/plain', 'application/json' ){
5858 # HEAVY BLACK HEART
5959 is get_raw($filedata ), " i \x{2764} metacpan" , ' correct message' ;
6060 ok !@warnings , ' no warnings after valid UTF-8' or diag shift @warnings ;
61+
62+ # not sure if we'll ever actually get undef
63+ is get_raw(undef ), ' ' , ' undef becomes blank' ;
64+ ok !@warnings , ' no warnings for undef' or diag shift @warnings ;
65+
66+ # not sure if we'll ever actually get blessed object
67+ my $b = Blessed_String-> new(' holy' );
68+ ok ref $b , ' blessed ref' ;
69+ is " $b " , ' holy' , ' stringifies correctly' ;
70+ is get_raw($b ), ' holy' , ' blessed string' ;
71+ ok !@warnings , ' no warnings for blessed obj' or diag shift @warnings ;
6172}
6273
6374done_testing;
6475
76+ { package # no_index
77+ Blessed_String;
78+ sub new { bless [ $_ [1] ], $_ [0]; }
79+ use overload ' ""' => sub { shift -> [0] };
80+ }
81+
6582__DATA__
6683i ❤ metacpan
You can’t perform that action at this time.
0 commit comments