File: 00versions.t

package info (click to toggle)
libhash-asobject-perl 0.13-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 124 kB
  • sloc: perl: 239; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/perl

use strict;
use warnings;

use Test::More;

eval "use YAML";

plan 'skip_all', "Can't check prerequisites in META.yml - YAML not installed"
    if $@;

my @modules = qw();

eval {
    my $meta = YAML::LoadFile('META.yml');
    my $prereqs = $meta->{'requires'};
    push @modules, keys %$prereqs
        if ref($prereqs) eq 'HASH';
};

plan 'tests' => 1;

if ($@) {
    fail( "An error occurred while fetching prerequisites from META.yml: $@" )
}

print STDERR "\n# Reporting module versions in case there are test failures\n"
    if scalar @modules;

foreach (@modules) {
    no strict 'refs';
    eval "require $_";
    my $version = $@ ? 'not installed' : ${ "${_}::VERSION" } || 'unknown';
    print STDERR sprintf("#   %s - %s\n", $_, $version);
}

ok( 1, 'report versions' );