]> sjero.net Git - wget/blob - tests/Test-E-k.px
Merge build info with head.
[wget] / tests / Test-E-k.px
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use HTTPTest;
6
7
8 ###############################################################################
9
10 my $mainpage = <<EOF;
11 <html>
12 <head>
13   <title>Main Page Title</title>
14 </head>
15 <body>
16   <a href="http://localhost:{{port}}/subpage.php">Secondary Page</a>
17 </body>
18 </html>
19 EOF
20
21 my $mainpagemangled = <<EOF;
22 <html>
23 <head>
24   <title>Main Page Title</title>
25 </head>
26 <body>
27   <a href="subpage.php.html">Secondary Page</a>
28 </body>
29 </html>
30 EOF
31
32 my $subpage = <<EOF;
33 <html>
34 <head>
35   <title>Secondary Page Title</title>
36 </head>
37 <body>
38   <p>Some text</p>
39 </body>
40 </html>
41 EOF
42
43 # code, msg, headers, content
44 my %urls = (
45     '/index.php' => {
46         code => "200",
47         msg => "Dontcare",
48         headers => {
49             "Content-type" => "text/html",
50         },
51         content => $mainpage,
52     },
53     '/subpage.php' => {
54         code => "200",
55         msg => "Dontcare",
56         headers => {
57             "Content-type" => "text/html",
58         },
59         content => $subpage,
60     },
61 );
62
63 my $cmdline = $WgetTest::WGETPATH . " -r -nd -E -k http://localhost:{{port}}/index.php";
64
65 my $expected_error_code = 0;
66
67 my %expected_downloaded_files = (
68     'index.php.html' => {
69         content => $mainpagemangled,
70     },
71     'subpage.php.html' => {
72         content => $subpage,
73     },
74 );
75
76 ###############################################################################
77
78 my $the_test = HTTPTest->new (name => "Test-E-k",
79                               input => \%urls, 
80                               cmdline => $cmdline, 
81                               errcode => $expected_error_code, 
82                               output => \%expected_downloaded_files);
83 exit $the_test->run();
84
85 # vim: et ts=4 sw=4
86