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