]> sjero.net Git - wget/blob - tests/Test--spider-r--no-content-disposition-trivial.px
Catch failures in Test-N-current.px.
[wget] / tests / Test--spider-r--no-content-disposition-trivial.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>
14 </head>
15 <body>
16   <p>
17     Some text and a link to a <a href="http://localhost:8080/secondpage.html">second page</a>.
18     Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
19   </p>
20 </body>
21 </html>
22 EOF
23
24 my $secondpage = <<EOF;
25 <html>
26 <head>
27   <title>Second Page</title>
28 </head>
29 <body>
30   <p>
31     Some text and a link to a <a href="http://localhost:8080/thirdpage.html">third page</a>.
32     Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
33   </p>
34 </body>
35 </html>
36 EOF
37
38 my $thirdpage = <<EOF;
39 <html>
40 <head>
41   <title>Third Page</title>
42 </head>
43 <body>
44   <p>
45     Some text and a link to a <a href="http://localhost:8080/dummy.txt">text file</a>.
46     Also, another <a href="http://localhost:8080/againnonexistent">broken link</a>.
47   </p>
48 </body>
49 </html>
50 EOF
51
52 my $dummyfile = <<EOF;
53 Don't care.
54 EOF
55
56 # code, msg, headers, content
57 my %urls = (
58     '/index.html' => {
59         code => "200",
60         msg => "Dontcare",
61         headers => {
62             "Content-type" => "text/html",
63         },
64         content => $mainpage,
65     },
66     '/secondpage.html' => {
67         code => "200",
68         msg => "Dontcare",
69         headers => {
70             "Content-type" => "text/html",
71         },
72         content => $secondpage,
73     },
74     '/thirdpage.html' => {
75         code => "200",
76         msg => "Dontcare",
77         headers => {
78             "Content-type" => "text/html",
79         },
80         content => $thirdpage,
81     },
82     '/dummy.txt' => {
83         code => "200",
84         msg => "Dontcare",
85         headers => {
86             "Content-type" => "text/plain",
87         },
88         content => $dummyfile
89     },
90 );
91
92 my $cmdline = $WgetTest::WGETPATH . " --spider -r --no-content-disposition http://localhost:8080/";
93
94 my $expected_error_code = 0;
95
96 my %expected_downloaded_files = (
97 );
98
99 ###############################################################################
100
101 my $the_test = HTTPTest->new (name => "Test--spider-r--no-content-disposition-trivial",
102                               input => \%urls, 
103                               cmdline => $cmdline, 
104                               errcode => $expected_error_code, 
105                               output => \%expected_downloaded_files);
106 exit $the_test->run();
107
108 # vim: et ts=4 sw=4
109