MountPoints probe tests
Robert 'phaylon' Sedlacek [Tue, 8 May 2012 19:10:24 +0000 (19:10 +0000)]
t/mountpoints.t [new file with mode: 0644]

diff --git a/t/mountpoints.t b/t/mountpoints.t
new file mode 100644 (file)
index 0000000..4f3428e
--- /dev/null
@@ -0,0 +1,34 @@
+use strictures 1;
+use Test::More;
+
+use System::Introspector::MountPoints;
+
+my $probe = System::Introspector::MountPoints->new;
+my $data  = $probe->gather;
+
+ok $data->{fstab}, 'received fstab data';
+ok $data->{mtab},  'received mtab data';
+
+my @fields = qw(
+    device_name
+    dump_freq
+    fs_type
+    mount_point
+    options
+    pass_num
+);
+
+my $run_test = sub {
+    my $tab = shift;
+    return sub {
+        for my $field (@fields) {
+            ok not(grep { not defined $_->{$field} } @$tab),
+                "all have $field";
+        }
+    };
+};
+
+subtest fstab => $run_test->($data->{fstab});
+subtest mtab => $run_test->($data->{mtab});
+
+done_testing;