Skip to content

Commit 0c02c84

Browse files
committed
In HttpGetFile.t, test digest of GitHub archive
1 parent 7aec412 commit 0c02c84

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

t/HttpGetFile.t

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ my $english_locale = (Win32::FormatMessage(1) eq "Incorrect function.\r\n");
1818
# We may not always have an internet connection, so don't
1919
# attempt remote connections unless the user has done
2020
# set PERL_WIN32_INTERNET_OK=1
21-
plan tests => $ENV{PERL_WIN32_INTERNET_OK} ? 12 : 7;
21+
plan tests => $ENV{PERL_WIN32_INTERNET_OK} ? 13 : 7;
2222

2323
# On Cygwin the test_harness will invoke additional Win32 APIs that
2424
# will reset the Win32::GetLastError() value, so capture it immediately.
@@ -71,7 +71,15 @@ if ($ENV{PERL_WIN32_INTERNET_OK}) {
7171
skip("Cannot verify error on non-English locale setting");
7272
}
7373
# Since all GitHub downloads use redirects, we can test that they work.
74+
1 while unlink $tmpfile;
7475
ok(Win32::HttpGetFile('https://github.com/perl-libwin32/win32/archive/refs/tags/v0.57.zip', $tmpfile),
7576
'1',
7677
"successfully downloaded a zipball via redirect");
78+
79+
$sha = undef;
80+
$sha = Digest::SHA->new('sha1');
81+
$sha->addfile($tmpfile, 'b');
82+
ok($sha->hexdigest,
83+
'9d282e2292e67fb2e25422dfb190474e30a38de3',
84+
"downloaded GitHub zip archive has correct digest");
7785
}

0 commit comments

Comments
 (0)