]> sjero.net Git - wget/blob - tests/Test-c-shorter.px
Test for -c shorter content (#23613).
[wget] / tests / Test-c-shorter.px
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use HTTPTest;
6
7
8 ###############################################################################
9
10 my $partiallydownloaded = <<EOF;
11 11111111111111111111111111111111111111111111111111
12 22222222x222222222222222222222222222222222222222222222222222
13 EOF
14
15 my $rest = <<EOF;
16 3333333333333333333333333333333333333333333333333333333333333333333333
17 444444444444444444444444444444444444444444444444444444444444
18 55555555555555555555555555555555555555555555555555
19 EOF
20
21 my $downloadedfile = $partiallydownloaded . $rest;
22
23 # code, msg, headers, content
24 my %urls = (
25     '/somefile.txt' => {
26         code => "200",
27         force_code => 1,
28         msg => "Dontcare",
29         headers => {
30             "Content-type" => "text/plain",
31             "Content-Length" => 0,
32         },
33         content => '',
34     },
35 );
36
37 my $cmdline = $WgetTest::WGETPATH . " -c http://localhost:{{port}}/somefile.txt";
38
39 my $expected_error_code = 0;
40
41 my %existing_files = (
42     'somefile.txt' => {
43         content => $downloadedfile,
44     },
45 );
46
47 my %expected_downloaded_files = (
48     'somefile.txt' => {
49         content => $downloadedfile,
50     },
51 );
52
53 ###############################################################################
54
55 my $the_test = HTTPTest->new (name => "Test-c-partial",
56                               input => \%urls, 
57                               cmdline => $cmdline, 
58                               errcode => $expected_error_code, 
59                               existing => \%existing_files,
60                               output => \%expected_downloaded_files);
61 exit $the_test->run();
62
63 # vim: et ts=4 sw=4
64