X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F20-extended.t;h=8876414ce511f9b267bc4cae8dd97fdd65f29d23;hb=ffd28b6ca6ef34779e1fc40bf2acd053e36935a7;hp=c8a270e6711320095c6f1ced0664cca6fa8e925d;hpb=01cae1ae25699e5619d0daa4670f0c8930b433bf;p=perl%2Fmodules%2FLinux-SysInfo.git diff --git a/t/20-extended.t b/t/20-extended.t index c8a270e..8876414 100644 --- a/t/20-extended.t +++ b/t/20-extended.t @@ -10,12 +10,24 @@ use Linux::SysInfo qw/sysinfo LS_HAS_EXTENDED/; unless (LS_HAS_EXTENDED) { plan skip_all => 'your kernel does not support extended sysinfo fields'; } else { - plan tests => 4 * 5; + plan tests => 5 * 5; - for (1 .. 5) { - my $si = sysinfo; - ok(defined $si); + SKIP: { + for my $run (0 .. 4) { + my $si = sysinfo; + skip 'system error (sysinfo returned undef)' => (5 - $run) * 5 + unless defined $si; + is ref($si), 'HASH', "sysinfo returns a hash reference at run $run"; + is scalar(keys %$si), 14, "sysinfo object has the right number of keys at run $run"; - ok(exists $si->{$_}) for qw/totalhigh freehigh mem_unit/; + for (qw/totalhigh freehigh mem_unit/) { + if (defined $si->{$_}) { + like $si->{$_}, qr/^\d+(?:\.\d+)?$/, + "key $_ looks like a number at run $run"; + } else { + fail "key $_ isn't defined at run $run"; + } + } + } } }