~ubuntu-branches/ubuntu/utopic/spamassassin/utopic-proposed

« back to all changes in this revision

Viewing changes to t/uri.t

  • Committer: Bazaar Package Importer
  • Author(s): Noah Meyerhans
  • Date: 2010-01-26 22:53:12 UTC
  • mfrom: (1.1.13 upstream) (5.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100126225312-wkftb10idc1kz2aq
Tags: 3.3.0-1
* New upstream version.
* Switch to dpkg-source 3.0 (quilt) format

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
use Mail::SpamAssassin::HTML;
24
24
use Mail::SpamAssassin::Util;
25
25
 
26
 
plan tests => 89;
 
26
plan tests => 95;
27
27
 
28
28
##############################################
29
29
 
 
30
 
 
31
tstlocalrules ('
 
32
 
 
33
  util_rb_2tld live.com
 
34
  util_rb_3tld three.3ldlive.com
 
35
 
 
36
');
 
37
 
30
38
# initialize SpamAssassin
31
 
my $sa = create_saobj({'dont_copy_prefs' => 1});
 
39
my $sa = create_saobj({'dont_copy_prefs' => 1,
 
40
        # 'debug' => 1
 
41
});
32
42
 
33
43
$sa->init(0); # parse rules
34
44
 
46
56
ok ($urimap{'http://66.92.69.222/'});
47
57
ok ($urimap{'http://66.92.69.223/'});
48
58
ok ($urimap{'http://66.92.69.224/'});
49
 
ok ($urimap{'spamassassin.org'});
 
59
ok ($urimap{'http://spamassassin.org'});
50
60
ok (!$urimap{'CUMSLUTS.'});
51
61
ok (!$urimap{'CUMSLUTS..VIRGIN'});
52
62
 
58
68
 
59
69
  # undef is valid in some situations, so deal with it...
60
70
  if (!defined $expect) {
 
71
    warn("try_domains: failed! expect: undefined got: '$result'\n") if (defined $result);
61
72
    return !defined $result;
62
73
  }
63
74
  elsif (!defined $result) {
 
75
    warn "try_domains: failed! expect: '$expect' got: undefined\n";
64
76
    return 0;
65
77
  }
66
78
 
242
254
   'http://127.0.0.1',
243
255
   ]));
244
256
 
 
257
ok(try_canon([
 
258
   'http://0xcc.0xf.0x50.0x89/',
 
259
   ], [
 
260
   'http://0xcc.0xf.0x50.0x89/',
 
261
   'http://204.15.80.137/',
 
262
       ]));
 
263
 
 
264
ok(try_canon([
 
265
   'http://0xcc.0x50.0x89.0xf/',
 
266
   ], [
 
267
   'http://0xcc.0x50.0x89.0xf/',
 
268
   'http://204.80.137.15/',
 
269
       ]));
245
270
 
246
271
##############################################
247
272
 
305
330
ok(try($base, "g#s/../x", "http://a/b/c/g#s/../x"));
306
331
ok(try($base, "http:g", "http://a/b/c/g"));
307
332
 
 
333
# uses the util_rb_*tld lines above
 
334
ok(try_domains('WWW.LIVE.com', 'www.live.com'));
 
335
ok(try_domains('WWW.foo.LIVE.com', 'foo.live.com'));
 
336
ok(try_domains('WWW.three.3ldLIVE.com', 'www.three.3ldlive.com'));
 
337
ok(try_domains('WWW.foo.basicLIVE.com', 'basiclive.com'));
 
338