File: 31_modulekeeper_get_packages_uniq.t

package info (click to toggle)
plsense 0.3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,012 kB
  • sloc: perl: 9,767; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 1,180 bytes parent folder | download | duplicates (4)
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
use Test::More;
use FindBin;
use lib "$FindBin::Bin/../tlib";
use TestSupport;
use PlSense::Configure;
use PlSense::ModuleKeeper;
use PlSense::Symbol::Module;

my $tmpdir = get_tmp_dir();
ok(-d $tmpdir, "get tmp directory");

set_primary_config(cachedir => $tmpdir);
setup_config();
my $mdlkeeper = PlSense::ModuleKeeper->new();
ok($mdlkeeper->isa("PlSense::ModuleKeeper"), "new");

my $filepath = $FindBin::Bin."/../tlib/TestSupport.pm";
$mdlkeeper->store_module(PlSense::Symbol::Module->new({ name => "hoge", filepath => $filepath, lastmodified => 0, }));
$mdlkeeper->store_module(PlSense::Symbol::Module->new({ name => "fuga", filepath => $filepath, lastmodified => 0, }));
$mdlkeeper->store_module(PlSense::Symbol::Module->new({ name => "hoge", filepath => $filepath, lastmodified => 0, }));
$mdlkeeper->store_module(PlSense::Symbol::Module->new({ name => "bar", filepath => $filepath, lastmodified => 0, }));

my @mdls = $mdlkeeper->get_packages();
is( $#mdls, 2, "number of package" );
is( $mdls[0]->get_name(), "bar", "name of package 1" );
is( $mdls[1]->get_name(), "fuga", "name of package 2" );
is( $mdls[2]->get_name(), "hoge", "name of package 3" );

done_testing();