]> sjero.net Git - wget/blob - tests/Test-ftp-list-UNIX-hidden.px
"LIST" or "LIST -a" ftp command according to the remote system
[wget] / tests / Test-ftp-list-UNIX-hidden.px
1 #!/usr/bin/env perl
2
3 # 2013-10-17 Andrea Urbani (matfanjol)
4 # In this ftp test:
5 # - the response of "LIST -a" command contains
6 #   all the files
7 # - the response of "LIST" command contains
8 #   the normal files (hidden files are not present)
9 # wget should use only "LIST -a" because it recognise
10 # the system as "UNIX Type: L8" and so it should see
11 # and download the hidden file too.
12
13 use strict;
14 use warnings;
15
16 use FTPTest;
17
18
19 ###############################################################################
20
21 my $normalfile = <<EOF;
22 I'm a normal file
23 EOF
24
25 my $hiddenfile = <<EOF;
26 I'm an hidden file
27 EOF
28
29 $normalfile =~ s/\n/\r\n/g;
30 $hiddenfile =~ s/\n/\r\n/g;
31
32 # code, msg, headers, content
33 my %urls = (
34     '/normalfile.txt' => {
35         content => $normalfile,
36     },
37     '/hiddenfile.txt' => {
38         content => $hiddenfile,
39         attr => "H",
40     },
41 );
42
43 my $cmdline = $WgetTest::WGETPATH . " --no-directories --recursive --level=1 ftp://localhost:{{port}}/";
44
45 my $expected_error_code = 0;
46
47 my %expected_downloaded_files = (
48     'normalfile.txt' => {
49         content => $normalfile,
50     },
51     'hiddenfile.txt' => {
52         content => $hiddenfile,
53     },
54 );
55
56 ###############################################################################
57
58 my $the_test = FTPTest->new (name => "Test-ftp-list-UNIX-hidden",
59                              input => \%urls,
60                              cmdline => $cmdline,
61                              errcode => $expected_error_code,
62                              output => \%expected_downloaded_files,
63                              server_behavior => {list_no_hidden_if_list => 1});
64 exit $the_test->run();
65