Help language development. Donate to The Perl Foundation

URI::FetchFile cpan:JSTOWE last updated on 2021-04-02

#!/usr/bin/env raku

use v6;

use Test;
plan 8;

use URI::FetchFile;

my $type = URI::FetchFile::Provider::LWP::Simple;

is $type.class-name, 'LWP::Simple', "got class name";

my $class;
lives-ok { $class = $type.type }, "type";

if $ {
    lives-ok {
        nok $type.fetch(uri => '', file => 'test-output'), "get with a 404";
    }, "fetch on a non-existent file";
    nok 'test-output'.IO.e, "and the file didn't get created";
    lives-ok {
        ok $type.fetch(uri => '', file => 'test-output'), "get with a real resource";
    }, "and get an existingy one";
    ok 'test-output'.IO.e, 'and the file does exist';
else {
    skip-rest "LWP::Simple provider isn't available";

# vim: expandtab shiftwidth=4 ft=raku