File: linkz.t

package info (click to toggle)
libwww-shorten-perl 3.03-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 312 kB
  • sloc: perl: 253; makefile: 7
file content (23 lines) | stat: -rw-r--r-- 595 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use Test::More tests => 6;

BEGIN { use_ok WWW::Shorten::Linkz };

my $url = 'http://www.bbc.co.uk/cult/doctorwho/ebooks/lungbarrow/index.shtml';
my $re = qr{ ^ http:// lin\.kz / \? (\w+) $ }x;

SKIP: {
  skip 'lin.kz seems to be having trouble at the moment', 5;

  my $shortened;
  like(($shortened = makeashorterlink($url)), $re, 'make it shorter');

  is(makealongerlink($shortened), $url, 'make it longer');

  my ($code) = $shortened =~ $re;
  is (makealongerlink($code), $url, 'make it longer by Id');

  eval { &makeashorterlink() };
  ok($@);
  eval { &makealongerlink() };
  ok($@);
}