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

« back to all changes in this revision

Viewing changes to tests/Test-k.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 HTTPTest;
 
7
 
 
8
 
 
9
###############################################################################
 
10
 
 
11
my $index = <<EOF;
 
12
<html>
 
13
  <head>
 
14
    <title>Index</title>
 
15
  </head>
 
16
  <body>
 
17
    <a href="site;sub:.html">Site</a>
 
18
  </body>
 
19
</html>
 
20
EOF
 
21
 
 
22
my $converted = <<EOF;
 
23
<html>
 
24
  <head>
 
25
    <title>Index</title>
 
26
  </head>
 
27
  <body>
 
28
    <a href="site%3Bsub:.html">Site</a>
 
29
  </body>
 
30
</html>
 
31
EOF
 
32
 
 
33
my $site = <<EOF;
 
34
<html>
 
35
  <head>
 
36
    <title>Site</title>
 
37
  </head>
 
38
  <body>
 
39
    Subsite
 
40
  </body>
 
41
</html>
 
42
EOF
 
43
 
 
44
# code, msg, headers, content
 
45
my %urls = (
 
46
    '/index.html' => {
 
47
        code => "200",
 
48
        msg => "Ok",
 
49
        headers => {
 
50
            "Content-type" => "text/html",
 
51
        },
 
52
        content => $index,
 
53
    },
 
54
    '/site;sub:.html' => {
 
55
        code => "200",
 
56
        msg => "Ok",
 
57
        headers => {
 
58
            "Content-type" => "text/html",
 
59
        },
 
60
        content => $site,
 
61
    },
 
62
);
 
63
 
 
64
my $cmdline = $WgetTest::WGETPATH . " -k -r -nH http://localhost:{{port}}/index.html";
 
65
 
 
66
my $expected_error_code = 0;
 
67
 
 
68
my %expected_downloaded_files = (
 
69
    'index.html' => {
 
70
        content => $converted,
 
71
    },
 
72
    'site;sub:.html' => {
 
73
        content => $site,
 
74
    },
 
75
);
 
76
 
 
77
###############################################################################
 
78
 
 
79
my $the_test = HTTPTest->new (name => "Test-k",
 
80
                              input => \%urls,
 
81
                              cmdline => $cmdline,
 
82
                              errcode => $expected_error_code,
 
83
                              output => \%expected_downloaded_files);
 
84
exit $the_test->run();
 
85
 
 
86
# vim: et ts=4 sw=4
 
87