~ubuntu-branches/ubuntu/trusty/wget/trusty-updates

« back to all changes in this revision

Viewing changes to tests/Test-idn-robots.px

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2009-12-12 08:15:59 UTC
  • mfrom: (2.1.5 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091212081559-mvccl4kzdqb138y3
Tags: 1.12-1.1ubuntu1
* Merge from debian testing, remaining changes:
  - Add wget-udeb to ship wget.gnu as alternative to busybox wget
    implementation.
* Keep build dependencies in main:
  - debian/control: remove info2man build-dep
  - debian/patches/00list: disable wget-infopod_generated_manpage.dpatch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
use strict;
 
4
use warnings;
 
5
 
 
6
use WgetFeature qw(iri);
 
7
use HTTPTest;
 
8
 
 
9
# " Kon'nichiwa <dot> Japan
 
10
my $euc_jp_hostname = "\272\243\306\374\244\317.\306\374\313\334";
 
11
my $punycoded_hostname = 'xn--v9ju72g90p.xn--wgv71a';
 
12
 
 
13
###############################################################################
 
14
 
 
15
my $starter_file = <<EOF;
 
16
<a href="http://$euc_jp_hostname/foo.txt">The link</a>
 
17
EOF
 
18
 
 
19
my $result_file = <<EOF;
 
20
Found me!
 
21
EOF
 
22
 
 
23
# code, msg, headers, content
 
24
my %urls = (
 
25
    "http://$punycoded_hostname/index.html" => {
 
26
        code => "200",
 
27
        msg => "Yes, please",
 
28
        headers => {
 
29
            'Content-Type' => 'text/html; charset=EUC-JP',
 
30
        },
 
31
        content => $starter_file,
 
32
    },
 
33
    "http://$punycoded_hostname/foo.txt" => {
 
34
        code => "200",
 
35
        msg => "Uh-huh",
 
36
        headers => {
 
37
            'Content-Type' => 'text/plain',
 
38
        },
 
39
        content => $result_file,
 
40
    },
 
41
    "http://$punycoded_hostname/robots.txt" => {
 
42
        code => "200",
 
43
        msg => "Uh-huh",
 
44
        headers => {
 
45
            'Content-Type' => 'text/plain',
 
46
        },
 
47
        content => '',
 
48
    },
 
49
);
 
50
 
 
51
my $cmdline = $WgetTest::WGETPATH . " --debug --iri -rH"
 
52
    . " -e http_proxy=localhost:{{port}} --local-encoding=EUC-JP"
 
53
    . " http://$euc_jp_hostname/";
 
54
 
 
55
my $expected_error_code = 0;
 
56
 
 
57
my %expected_downloaded_files = (
 
58
    "$punycoded_hostname/index.html" => {
 
59
        content => $starter_file,
 
60
    },
 
61
    "$punycoded_hostname/foo.txt" => {
 
62
        content => $result_file,
 
63
    },
 
64
    "$punycoded_hostname/robots.txt" => {
 
65
        content => '',
 
66
    },
 
67
);
 
68
 
 
69
###############################################################################
 
70
 
 
71
my $the_test = HTTPTest->new (name => "Test-idn-robots",
 
72
                              input => \%urls,
 
73
                              cmdline => $cmdline,
 
74
                              errcode => $expected_error_code,
 
75
                              output => \%expected_downloaded_files);
 
76
exit $the_test->run();
 
77
 
 
78
# vim: et ts=4 sw=4
 
79