allow usage of a pool of mediawiki updaters instead of just single-process
[scpubgit/System-Introspector-Report.git] / t / builder_perls.t
CommitLineData
0331d9cd 1use strictures 1;
2use Test::More;
3use FindBin;
4use aliased 'System::Introspector::Report::Source';
5
6my $source = Source->new(root => "$FindBin::Bin/data/json/");
7my @reports = $source->generate(['Perls', {}]);
8
9is scalar(@reports), 1, 'single report generated';
10my $rep = $reports[0];
11
12is $rep->{id}, 'perls', 'report id';
13like $rep->{title}, qr{perl}i, 'report title contains perl';
14is_deeply $rep->{meta}, {}, 'no metadata in this report';
15is_deeply $rep->{rowid}, [qw( remote location )], 'correct rowid';
16my %cols = map { ($_->{key}, 1) } @{$rep->{columns}};
17ok $cols{$_}, "$_ column exists"
18 for qw( remote hostname location version );
19my @rows = (
20 { hostname => 'a.example.com',
21 remote => 'hostA',
22 location => '/foo/bar/perl',
23 version => '5.10.0',
24 },
25 { hostname => 'a.example.com',
26 remote => 'hostA',
27 location => '/foo/baz/perl',
28 version => '5.14.1',
29 },
30 { hostname => 'b.example.com',
31 remote => 'hostB',
32 location => '/foo/bar/perl',
33 version => '5.10.0',
34 },
35 { hostname => 'b.example.com',
36 remote => 'hostB',
37 location => '/foo/qux/perl',
38 version => '5.14.1',
39 },
40);
41for my $idx (0 .. $#rows) {
42 is $rep->{rows}[$idx]{$_}, $rows[$idx]{$_}, "row $idx $_ value"
43 for sort keys %{$rows[$idx]};
44}
45
46done_testing;