File: 01_basic.t

package info (click to toggle)
libperlanet-perl 2.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 444 kB
  • sloc: xml: 1,177; perl: 757; sh: 6; makefile: 5
file content (55 lines) | stat: -rw-r--r-- 1,025 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use strict;
use warnings;

use Test::More;
use FindBin qw($Bin);

use lib qw( ../lib );
use_ok('Perlanet::Simple');

chdir $Bin;
ok(my $p = Perlanet::Simple->new_with_config(configfile => 'testrc'),
   'Object created');
isa_ok($p, 'Perlanet');

if (-e $p->opml_file) {
  unlink $p->opml_file;
}

if (-e $p->feed->{file}) {
  unlink $p->feed->{file};
}

if (-e $p->page->{file}) {
  unlink $p->page->{file};
}

is($p->config->{google_ga}, 'HELLO_GOOGLE', 'Config is correct');

$p->run;

ok(-e $p->feed->{file}, 'Feed created');
ok(-e $p->page->{file}, 'Page created');
SKIP: {
  skip 'XML::OPML::SimpleGen not installed', 1 unless $p->has_opml;
  ok(-e $p->opml_file, 'OPML created');
}

if (-e $p->opml_file) {
  unlink $p->opml_file;
}

if (-e $p->feed->{file}) {
  unlink $p->feed->{file};
}

if (-e $p->page->{file}) {
  unlink $p->page->{file};
}

# Test OPML
ok($p = Perlanet->new_with_traits( traits => [ 'Perlanet::Trait::OPML' ]  ), 'Object with traits created');
isa_ok($p,'Perlanet');
$p->run();

done_testing();