]> sjero.net Git - wget/blob - tests/Test-N-current.px
Automated merge.
[wget] / tests / Test-N-current.px
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use HTTPTest;
6
7
8 ###############################################################################
9
10 my $currentversion = <<EOF;
11 11111111111111111111111111111111111111111111111111
12 222222222222222222222222222222222222222222222222222222222222
13 3333333333333333333333333333333333333333333333333333333333333333333333
14 444444444444444444444444444444444444444444444444444444444444
15 55555555555555555555555555555555555555555555555555
16 EOF
17
18 # The server should serve a slightly different content, but with the
19 # same length, so we can test which version was downloaded.
20 my $modifiedversion = $currentversion;
21 $modifiedversion =~ s/^(.{20}).(.*)$/$1x$2/s;
22
23 # code, msg, headers, content
24 my %urls = (
25     '/somefile.txt' => {
26         code => "200",
27         msg => "Dontcare",
28         headers => {
29             "Content-type" => "text/plain",
30             "Last-Modified" => "Sat, 09 Oct 2004 08:30:00 GMT",
31         },
32         content => $modifiedversion,
33     },
34 );
35
36 my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:{{port}}/somefile.txt";
37
38 my $expected_error_code = 0;
39
40 my %existing_files = (
41     'somefile.txt' => {
42         content => $currentversion,
43         timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT"
44     },
45 );
46
47 my %expected_downloaded_files = (
48     'somefile.txt' => {
49         content => $currentversion,
50         timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT"
51     },
52 );
53
54 ###############################################################################
55
56 my $the_test = HTTPTest->new (name => "Test-N-current",
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