]> git.vpit.fr Git - perl/modules/Linux-SysInfo.git/blobdiff - t/20-extended.t
Switch qw delimiters to <>
[perl/modules/Linux-SysInfo.git] / t / 20-extended.t
index c8a270e6711320095c6f1ced0664cca6fa8e925d..779fe256da4602f18aee4fd8cf30cfd3e5d90103 100644 (file)
@@ -5,17 +5,29 @@ use warnings;
 
 use Test::More;
 
-use Linux::SysInfo qw/sysinfo LS_HAS_EXTENDED/;
+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";
+    }
+   }
+  }
  }
 }