1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use FTPTest;
7
8
9###############################################################################
10
11my $afile = <<EOF;
12Some text.
13EOF
14
15my $bfile = <<EOF;
16Some more text.
17EOF
18
19$afile =~ s/\n/\r\n/g;
20$bfile =~ s/\n/\r\n/g;
21
22# code, msg, headers, content
23my %urls = (
24    '/afile.txt' => {
25        content => $afile,
26    },
27    '/bfile.txt' => {
28        content => $bfile,
29    },
30);
31
32my $cmdline = $WgetTest::WGETPATH . " -d -nH -Nc -r ftp://localhost:{{port}}/";
33
34my $expected_error_code = 0;
35
36# Don't need to worry about timestamps, the "bad_list" setting will
37# ensure the sizes don't match expectations, and so they'll always be
38# re-downloaded.
39my %expected_downloaded_files = (
40    'afile.txt' => {
41        content => $afile,
42    },
43    'bfile.txt' => {
44        content => $bfile,
45    },
46);
47
48my %preexisting_files = (
49    'afile.txt' => {
50        content => $afile,
51    },
52    'bfile.txt' => {
53        content => $bfile,
54    },
55);
56
57###############################################################################
58
59my $the_test = FTPTest->new (name => "Test-ftp-bad-list",
60                             input => \%urls,
61                             cmdline => $cmdline,
62                             errcode => $expected_error_code,
63                             output => \%expected_downloaded_files,
64                             existing => \%preexisting_files,
65                             server_behavior => {bad_list => 1});
66exit $the_test->run();
67
68# vim: et ts=4 sw=4
69
70