"Fossies" - the Fresh Open Source Software Archive

Member "libwww-perl-6.43/t/leak/no_leak.t" (26 Nov 2019, 656 Bytes) of package /linux/www/libwww-perl-6.43.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 use strict;
    2 use warnings;
    3 
    4 # To ensure "no leak" in real LWP code, we should test it against HTTP servers.
    5 # However, HTTPS is not required here, so let's use an HTTP site neverssl.com.
    6 use Test::RequiresInternet 'neverssl.com' => 80;
    7 
    8 use Test::More;
    9 use Test::Needs 'Test::LeakTrace';
   10 
   11 use File::Temp ();
   12 use LWP::UserAgent;
   13 
   14 plan skip_all => 'skip leak test in COVERAGE' if $ENV{COVERAGE};
   15 
   16 my ($tempfh, $tempfile) = File::Temp::tempfile(UNLINK => 0);
   17 close $tempfh;
   18 
   19 Test::LeakTrace::no_leaks_ok(sub {
   20     my $ua = LWP::UserAgent->new;
   21     my $res = $ua->get("http://neverssl.com/", ':content_file' => $tempfile);
   22 });
   23 
   24 unlink $tempfile;
   25 
   26 done_testing;