From: mtortonesi Date: Thu, 12 Oct 2006 16:18:57 +0000 (-0700) Subject: [svn] Major testsuite update. X-Git-Tag: v1.13~615 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=f0b4f352bfedd1ac5b639db801445261f19a73ff [svn] Major testsuite update. --- diff --git a/tests/ChangeLog b/tests/ChangeLog index 6cba557a..daaa10fc 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,65 @@ +2006-10-12 Mauro Tortonesi + + * Test1.px: Renamed to Test-noop.px. + + * Test-noop.px: Ditto. + + * Test2.px: Renamed to Test-N.px. + + * Test-N.px: Ditto. + + * Test3.px: Renamed to Test-nonexisting-quiet.px. + + * Test-nonexisting-quiet.px: Ditto. + + * Test4.px: Renamed to Test-O-nonexisting.px. + + * Test-O-nonexisting.px: Ditto. + + * Test5.px: Renamed to Test-HTTP-Content-Disposition.px. + + * Test-HTTP-Content-Disposition.px: Ditto. + + * Test6.px: Renamed to Test-HTTP-Content-Disposition-1.px. + + * Test-HTTP-Content-Disposition-1.px: Ditto. + + * Test7.px: Renamed to Test-HTTP-Content-Disposition-2.px. + + * Test-HTTP-Content-Disposition-2.px: Ditto. + + * Test8.px: Replaced by Test--spider-r.px. + + * Test9.px: Renamed to Test-Restrict-Lowercase.px. + + * Test-Restrict-Lowercase.px: Ditto. + + * Test10.px: Renamed to Test-Restrict-Uppercase.px. + + * Test-Restrict-Uppercase.px: Ditto. + + * Test--spider.px: Added test for spider mode. + + * Test--spider-fail.px: Added failing test for spider mode. + + * Test--spider-r.px: Added test for recursive spider mode. + + * Test-c.px: Added test for --continue mode. + + * Test-c-full.px: Added test for --continue mode. + + * Test-c-partial.px: Added test for --continue mode. + + * Test-O.px: Added test for -O. + + * Test-N-current.px: Added test for -N. + + * Test-N-old.px: Added test for -N. + + * Test-E-k.px: Added test for -E -k. + + * Test-E-k-K.px: Added test for -E -k -K. + 2006-08-17 Mauro Tortonesi * HTTPServer.pm: Added support for Range header. diff --git a/tests/Test--spider-fail.px b/tests/Test--spider-fail.px new file mode 100755 index 00000000..9682681b --- /dev/null +++ b/tests/Test--spider-fail.px @@ -0,0 +1,52 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $mainpage = < + + Main Page + + +

+ Some text. +

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/index.html' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $mainpage, + }, +); + +my $cmdline = "wget --spider http://localhost:8080/nonexistent"; + +my $expected_error_code = 256; + +my %expected_downloaded_files = ( +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test--spider-fail", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test--spider-r.px b/tests/Test--spider-r.px new file mode 100755 index 00000000..94ca2c7a --- /dev/null +++ b/tests/Test--spider-r.px @@ -0,0 +1,109 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $mainpage = < + + Main Page + + +

+ Some text and a link to a second page. + Also, a broken link. +

+ + +EOF + +my $secondpage = < + + Second Page + + +

+ Some text and a link to a third page. + Also, a broken link. +

+ + +EOF + +my $thirdpage = < + + Third Page + + +

+ Some text and a link to a text file. + Also, another broken link. +

+ + +EOF + +my $dummyfile = < { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $mainpage, + }, + '/secondpage.html' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $secondpage, + }, + '/thirdpage.html' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $thirdpage, + }, + '/dummy.txt' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/plain", + }, + content => $dummyfile + }, +); + +my $cmdline = "wget --spider -r http://localhost:8080/"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test--spider-r", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test--spider.px b/tests/Test--spider.px new file mode 100755 index 00000000..2c58cebd --- /dev/null +++ b/tests/Test--spider.px @@ -0,0 +1,52 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $mainpage = < + + Main Page + + +

+ Some text. +

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/index.html' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $mainpage, + }, +); + +my $cmdline = "wget --spider http://localhost:8080/index.html"; + +my $expected_error_code = 256; + +my %expected_downloaded_files = ( +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test--spider", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-E-k-K.px b/tests/Test-E-k-K.px new file mode 100755 index 00000000..854d47ad --- /dev/null +++ b/tests/Test-E-k-K.px @@ -0,0 +1,89 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $mainpage = < + + Main Page Title + + + Secondary Page + + +EOF + +my $mainpagemangled = < + + Main Page Title + + + Secondary Page + + +EOF + +my $subpage = < + + Secondary Page Title + + +

Some text

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/index.php' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $mainpage, + }, + '/subpage.php' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $subpage, + }, +); + +my $cmdline = "wget -d -r -nd -E -k -K http://localhost:8080/index.php"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'index.php.orig' => { + content => $mainpage, + }, + 'index.php.html' => { + content => $mainpagemangled, + }, + 'subpage.php.html' => { + content => $subpage, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-E-k-K", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-E-k.px b/tests/Test-E-k.px new file mode 100755 index 00000000..86e2dcf6 --- /dev/null +++ b/tests/Test-E-k.px @@ -0,0 +1,86 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $mainpage = < + + Main Page Title + + + Secondary Page + + +EOF + +my $mainpagemangled = < + + Main Page Title + + + Secondary Page + + +EOF + +my $subpage = < + + Secondary Page Title + + +

Some text

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/index.php' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $mainpage, + }, + '/subpage.php' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $subpage, + }, +); + +my $cmdline = "wget -r -nd -E -k http://localhost:8080/index.php"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'index.php.html' => { + content => $mainpagemangled, + }, + 'subpage.php.html' => { + content => $subpage, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-E-k", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-HTTP-Content-Disposition-1.px b/tests/Test-HTTP-Content-Disposition-1.px new file mode 100755 index 00000000..3727ad16 --- /dev/null +++ b/tests/Test-HTTP-Content-Disposition-1.px @@ -0,0 +1,76 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $dontcare = < + + Page Title + + +

+ Some text. +

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/dummy.html' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + "Content-Disposition" => "attachment; filename=\"filename.html\"", + }, + content => $dummyfile, + }, +); + +my $cmdline = "wget http://localhost:8080/dummy.html"; + +my $expected_error_code = 0; + +my %existing_files = ( + 'filename.html' => { + content => $dontcare, + }, + 'filename.html.1' => { + content => $dontcare, + }, +); + +my %expected_downloaded_files = ( + 'filename.html' => { + content => $dontcare, + }, + 'filename.html.1' => { + content => $dontcare, + }, + 'filename.html.2' => { + content => $dummyfile, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test6", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + existing => \%existing_files, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-HTTP-Content-Disposition-2.px b/tests/Test-HTTP-Content-Disposition-2.px new file mode 100755 index 00000000..8064f76b --- /dev/null +++ b/tests/Test-HTTP-Content-Disposition-2.px @@ -0,0 +1,76 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $dontcare = < + + Page Title + + +

+ Some text. +

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/dummy.html' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + "Content-Disposition" => "attachment; filename=\"filename.html\"", + }, + content => $dummyfile, + }, +); + +my $cmdline = "wget --no-content-disposition http://localhost:8080/dummy.html"; + +my $expected_error_code = 0; + +my %existing_files = ( + 'filename.html' => { + content => $dontcare, + }, + 'filename.html.1' => { + content => $dontcare, + }, +); + +my %expected_downloaded_files = ( + 'filename.html' => { + content => $dontcare, + }, + 'filename.html.1' => { + content => $dontcare, + }, + 'dummy.html' => { + content => $dummyfile, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test7", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + existing => \%existing_files, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-HTTP-Content-Disposition.px b/tests/Test-HTTP-Content-Disposition.px new file mode 100755 index 00000000..c9bc62fa --- /dev/null +++ b/tests/Test-HTTP-Content-Disposition.px @@ -0,0 +1,56 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $dummyfile = < + + Page Title + + +

+ Some text. +

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/dummy.html' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + "Content-Disposition" => "attachment; filename=\"filename.html\"", + }, + content => $dummyfile, + }, +); + +my $cmdline = "wget http://localhost:8080/dummy.html"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'filename.html' => { + content => $dummyfile, + } +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test5", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-N-current.px b/tests/Test-N-current.px new file mode 100755 index 00000000..9343d179 --- /dev/null +++ b/tests/Test-N-current.px @@ -0,0 +1,57 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $wholefile = < { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/plain", + }, + content => $wholefile, + }, +); + +my $cmdline = "wget -c http://localhost:8080/somefile.txt"; + +my $expected_error_code = 0; + +my %existing_files = ( + 'somefile.txt' => { + content => $wholefile, + }, +); + +my %expected_downloaded_files = ( + 'somefile.txt' => { + content => $wholefile, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-N-current", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + existing => \%existing_files, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-N-old.px b/tests/Test-N-old.px new file mode 100755 index 00000000..7cdc3a0b --- /dev/null +++ b/tests/Test-N-old.px @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $oldversion = < { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/plain", + "Last-Modified" => "Sat, 09 Oct 2004 08:30:00 GMT", + }, + content => $newversion, + }, +); + +my $cmdline = "wget -N http://localhost:8080/somefile.txt"; + +my $expected_error_code = 0; + +my %existing_files = ( + 'somefile.txt' => { + content => $oldversion, + timestamp => 1097310000, # Earlier timestamp + }, +); + +my %expected_downloaded_files = ( + 'somefile.txt' => { + content => $newversion, + timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT" + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-N-old", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + existing => \%existing_files, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-N.px b/tests/Test-N.px new file mode 100755 index 00000000..d70171db --- /dev/null +++ b/tests/Test-N.px @@ -0,0 +1,48 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $dummyfile = < { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/plain", + "Last-Modified" => "Sat, 09 Oct 2004 08:30:00 GMT", + }, + content => $dummyfile + }, +); + +my $cmdline = "wget -N http://localhost:8080/dummy.txt"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'dummy.txt' => { + content => $dummyfile, + timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT" + } +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-N", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-O-nonexisting.px b/tests/Test-O-nonexisting.px new file mode 100755 index 00000000..676bd5f4 --- /dev/null +++ b/tests/Test-O-nonexisting.px @@ -0,0 +1,46 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $dummyfile = < { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $dummyfile + }, +); + +my $cmdline = "wget --quiet -O out http://localhost:8080/nonexistent"; + +my $expected_error_code = 256; + +my %expected_downloaded_files = ( + 'out' => { + content => "", + } +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test4", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-O.px b/tests/Test-O.px new file mode 100755 index 00000000..722ff39c --- /dev/null +++ b/tests/Test-O.px @@ -0,0 +1,46 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $dummyfile = < { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/plain", + }, + content => $dummyfile + }, +); + +my $cmdline = "wget -O out http://localhost:8080/dummy.txt"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'out' => { + content => $dummyfile, + } +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-O", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-Restrict-Lowercase.px b/tests/Test-Restrict-Lowercase.px new file mode 100755 index 00000000..98c8ed60 --- /dev/null +++ b/tests/Test-Restrict-Lowercase.px @@ -0,0 +1,55 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $mainpage = < + + Some Page Title + + +

+ Some text... +

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/SomePage.html' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $mainpage, + }, +); + +my $cmdline = "wget --restrict-file-names=lowercase http://localhost:8080/SomePage.html"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'somepage.html' => { + content => $mainpage, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test9", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-Restrict-Uppercase.px b/tests/Test-Restrict-Uppercase.px new file mode 100755 index 00000000..e2294030 --- /dev/null +++ b/tests/Test-Restrict-Uppercase.px @@ -0,0 +1,55 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $mainpage = < + + Some Page Title + + +

+ Some text... +

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/SomePage.html' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $mainpage, + }, +); + +my $cmdline = "wget --restrict-file-names=uppercase http://localhost:8080/SomePage.html"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'SOMEPAGE.HTML' => { + content => $mainpage, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test9", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-c-full.px b/tests/Test-c-full.px new file mode 100755 index 00000000..c57182ef --- /dev/null +++ b/tests/Test-c-full.px @@ -0,0 +1,57 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $wholefile = < { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/plain", + }, + content => $wholefile, + }, +); + +my $cmdline = "wget -c http://localhost:8080/somefile.txt"; + +my $expected_error_code = 0; + +my %existing_files = ( + 'somefile.txt' => { + content => $wholefile, + }, +); + +my %expected_downloaded_files = ( + 'somefile.txt' => { + content => $wholefile, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-c-full", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + existing => \%existing_files, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-c-partial.px b/tests/Test-c-partial.px new file mode 100755 index 00000000..8661cfa6 --- /dev/null +++ b/tests/Test-c-partial.px @@ -0,0 +1,62 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $partiallydownloaded = < { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/plain", + }, + content => $wholefile, + }, +); + +my $cmdline = "wget -c http://localhost:8080/somefile.txt"; + +my $expected_error_code = 0; + +my %existing_files = ( + 'somefile.txt' => { + content => $partiallydownloaded, + }, +); + +my %expected_downloaded_files = ( + 'somefile.txt' => { + content => $wholefile, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-c-partial", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + existing => \%existing_files, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-c.px b/tests/Test-c.px new file mode 100755 index 00000000..4306cab6 --- /dev/null +++ b/tests/Test-c.px @@ -0,0 +1,54 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $wholefile = < { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/plain", + }, + content => $wholefile, + }, +); + +my $cmdline = "wget -c http://localhost:8080/somefile.txt"; + +my $expected_error_code = 0; + +my %existing_files = ( +); + +my %expected_downloaded_files = ( + 'somefile.txt' => { + content => $wholefile, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-c", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + existing => \%existing_files, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-nonexisting-quiet.px b/tests/Test-nonexisting-quiet.px new file mode 100755 index 00000000..97ee275e --- /dev/null +++ b/tests/Test-nonexisting-quiet.px @@ -0,0 +1,43 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $dummyfile = < { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/plain", + }, + content => $dummyfile + }, +); + +my $cmdline = "wget --quiet http://localhost:8080/nonexistent"; + +my $expected_error_code = 256; + +my %expected_downloaded_files = ( +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-nonexisting-quiet", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test-noop.px b/tests/Test-noop.px new file mode 100755 index 00000000..296e845a --- /dev/null +++ b/tests/Test-noop.px @@ -0,0 +1,56 @@ +#!/usr/bin/perl -w + +use strict; + +use HTTPTest; + + +############################################################################### + +my $index = < + + Page Title + + +

Page Title

+

+ Some text here. +

+ + +EOF + +# code, msg, headers, content +my %urls = ( + '/index.html' => { + code => "200", + msg => "Dontcare", + headers => { + "Content-type" => "text/html", + }, + content => $index + }, +); + +my $cmdline = "wget http://localhost:8080/"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'index.html' => { + content => $index, + } +); + +############################################################################### + +my $the_test = HTTPTest->new (name => "Test-noop", + input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +$the_test->run(); + +# vim: et ts=4 sw=4 + diff --git a/tests/Test1.px b/tests/Test1.px deleted file mode 100755 index 2da6cdae..00000000 --- a/tests/Test1.px +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use HTTPTest; - - -############################################################################### - -my $dummyfile = < { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/plain", - }, - content => $dummyfile - }, -); - -my $cmdline = "wget http://localhost:8080/dummy.html"; - -my $expected_error_code = 0; - -my %expected_downloaded_files = ( - 'dummy.html' => { - content => $dummyfile, - } -); - -############################################################################### - -my $the_test = HTTPTest->new (name => "Test1", - input => \%urls, - cmdline => $cmdline, - errcode => $expected_error_code, - output => \%expected_downloaded_files); -$the_test->run(); - -# vim: et ts=4 sw=4 - diff --git a/tests/Test10.px b/tests/Test10.px deleted file mode 100755 index e2294030..00000000 --- a/tests/Test10.px +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use HTTPTest; - - -############################################################################### - -my $mainpage = < - - Some Page Title - - -

- Some text... -

- - -EOF - -# code, msg, headers, content -my %urls = ( - '/SomePage.html' => { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/html", - }, - content => $mainpage, - }, -); - -my $cmdline = "wget --restrict-file-names=uppercase http://localhost:8080/SomePage.html"; - -my $expected_error_code = 0; - -my %expected_downloaded_files = ( - 'SOMEPAGE.HTML' => { - content => $mainpage, - }, -); - -############################################################################### - -my $the_test = HTTPTest->new (name => "Test9", - input => \%urls, - cmdline => $cmdline, - errcode => $expected_error_code, - output => \%expected_downloaded_files); -$the_test->run(); - -# vim: et ts=4 sw=4 - diff --git a/tests/Test2.px b/tests/Test2.px deleted file mode 100755 index 20ece7d2..00000000 --- a/tests/Test2.px +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use HTTPTest; - - -############################################################################### - -my $dummyfile = < { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/html", - "Last-Modified" => "Sat, 09 Oct 2004 08:30:00 GMT", - }, - content => $dummyfile - }, -); - -my $cmdline = "wget -N http://localhost:8080/dummy.html"; - -my $expected_error_code = 0; - -my %expected_downloaded_files = ( - 'dummy.html' => { - content => $dummyfile, - timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT" - } -); - -############################################################################### - -my $the_test = HTTPTest->new (name => "Test2", - input => \%urls, - cmdline => $cmdline, - errcode => $expected_error_code, - output => \%expected_downloaded_files); -$the_test->run(); - -# vim: et ts=4 sw=4 - diff --git a/tests/Test3.px b/tests/Test3.px deleted file mode 100755 index d10f8ea9..00000000 --- a/tests/Test3.px +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use HTTPTest; - - -############################################################################### - -my $dummyfile = < { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/plain", - }, - content => $dummyfile - }, -); - -my $cmdline = "wget --quiet http://localhost:8080/nonexistent"; - -my $expected_error_code = 256; - -my %expected_downloaded_files = ( -); - -############################################################################### - -my $the_test = HTTPTest->new (name => "Test3", - input => \%urls, - cmdline => $cmdline, - errcode => $expected_error_code, - output => \%expected_downloaded_files); -$the_test->run(); - -# vim: et ts=4 sw=4 - diff --git a/tests/Test4.px b/tests/Test4.px deleted file mode 100755 index d0bc67c1..00000000 --- a/tests/Test4.px +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use HTTPTest; - - -############################################################################### - -my $dummyfile = < { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/plain", - }, - content => $dummyfile - }, -); - -my $cmdline = "wget --quiet -O out http://localhost:8080/nonexistent"; - -my $expected_error_code = 256; - -my %expected_downloaded_files = ( - 'out' => { - content => "", - } -); - -############################################################################### - -my $the_test = HTTPTest->new (name => "Test4", - input => \%urls, - cmdline => $cmdline, - errcode => $expected_error_code, - output => \%expected_downloaded_files); -$the_test->run(); - -# vim: et ts=4 sw=4 - diff --git a/tests/Test5.px b/tests/Test5.px deleted file mode 100755 index c9bc62fa..00000000 --- a/tests/Test5.px +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use HTTPTest; - - -############################################################################### - -my $dummyfile = < - - Page Title - - -

- Some text. -

- - -EOF - -# code, msg, headers, content -my %urls = ( - '/dummy.html' => { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/html", - "Content-Disposition" => "attachment; filename=\"filename.html\"", - }, - content => $dummyfile, - }, -); - -my $cmdline = "wget http://localhost:8080/dummy.html"; - -my $expected_error_code = 0; - -my %expected_downloaded_files = ( - 'filename.html' => { - content => $dummyfile, - } -); - -############################################################################### - -my $the_test = HTTPTest->new (name => "Test5", - input => \%urls, - cmdline => $cmdline, - errcode => $expected_error_code, - output => \%expected_downloaded_files); -$the_test->run(); - -# vim: et ts=4 sw=4 - diff --git a/tests/Test6.px b/tests/Test6.px deleted file mode 100755 index 3727ad16..00000000 --- a/tests/Test6.px +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use HTTPTest; - - -############################################################################### - -my $dontcare = < - - Page Title - - -

- Some text. -

- - -EOF - -# code, msg, headers, content -my %urls = ( - '/dummy.html' => { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/html", - "Content-Disposition" => "attachment; filename=\"filename.html\"", - }, - content => $dummyfile, - }, -); - -my $cmdline = "wget http://localhost:8080/dummy.html"; - -my $expected_error_code = 0; - -my %existing_files = ( - 'filename.html' => { - content => $dontcare, - }, - 'filename.html.1' => { - content => $dontcare, - }, -); - -my %expected_downloaded_files = ( - 'filename.html' => { - content => $dontcare, - }, - 'filename.html.1' => { - content => $dontcare, - }, - 'filename.html.2' => { - content => $dummyfile, - }, -); - -############################################################################### - -my $the_test = HTTPTest->new (name => "Test6", - input => \%urls, - cmdline => $cmdline, - errcode => $expected_error_code, - existing => \%existing_files, - output => \%expected_downloaded_files); -$the_test->run(); - -# vim: et ts=4 sw=4 - diff --git a/tests/Test7.px b/tests/Test7.px deleted file mode 100755 index 8064f76b..00000000 --- a/tests/Test7.px +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use HTTPTest; - - -############################################################################### - -my $dontcare = < - - Page Title - - -

- Some text. -

- - -EOF - -# code, msg, headers, content -my %urls = ( - '/dummy.html' => { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/html", - "Content-Disposition" => "attachment; filename=\"filename.html\"", - }, - content => $dummyfile, - }, -); - -my $cmdline = "wget --no-content-disposition http://localhost:8080/dummy.html"; - -my $expected_error_code = 0; - -my %existing_files = ( - 'filename.html' => { - content => $dontcare, - }, - 'filename.html.1' => { - content => $dontcare, - }, -); - -my %expected_downloaded_files = ( - 'filename.html' => { - content => $dontcare, - }, - 'filename.html.1' => { - content => $dontcare, - }, - 'dummy.html' => { - content => $dummyfile, - }, -); - -############################################################################### - -my $the_test = HTTPTest->new (name => "Test7", - input => \%urls, - cmdline => $cmdline, - errcode => $expected_error_code, - existing => \%existing_files, - output => \%expected_downloaded_files); -$the_test->run(); - -# vim: et ts=4 sw=4 - diff --git a/tests/Test8.px b/tests/Test8.px deleted file mode 100755 index 9d4a3081..00000000 --- a/tests/Test8.px +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use HTTPTest; - - -############################################################################### - -my $mainpage = < - - Main Page Title - - - Secondary Page - - -EOF - -my $subpage = < - - Secondary Page Title - - - Broken Link - - -EOF - -# code, msg, headers, content -my %urls = ( - '/index.html' => { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/html", - }, - content => $mainpage, - }, - '/subpage.html' => { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/html", - }, - content => $subpage, - }, -); - -my $cmdline = "wget --spider -r http://localhost:8080/"; - -my $expected_error_code = 0; - -my %expected_downloaded_files = ( -); - -############################################################################### - -my $the_test = HTTPTest->new (name => "Test8", - input => \%urls, - cmdline => $cmdline, - errcode => $expected_error_code, - output => \%expected_downloaded_files); -$the_test->run(); - -# vim: et ts=4 sw=4 - diff --git a/tests/Test9.px b/tests/Test9.px deleted file mode 100755 index 98c8ed60..00000000 --- a/tests/Test9.px +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use HTTPTest; - - -############################################################################### - -my $mainpage = < - - Some Page Title - - -

- Some text... -

- - -EOF - -# code, msg, headers, content -my %urls = ( - '/SomePage.html' => { - code => "200", - msg => "Dontcare", - headers => { - "Content-type" => "text/html", - }, - content => $mainpage, - }, -); - -my $cmdline = "wget --restrict-file-names=lowercase http://localhost:8080/SomePage.html"; - -my $expected_error_code = 0; - -my %expected_downloaded_files = ( - 'somepage.html' => { - content => $mainpage, - }, -); - -############################################################################### - -my $the_test = HTTPTest->new (name => "Test9", - input => \%urls, - cmdline => $cmdline, - errcode => $expected_error_code, - output => \%expected_downloaded_files); -$the_test->run(); - -# vim: et ts=4 sw=4 -