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