From: Robert 'phaylon' Sedlacek <r.sedlacek@shadowcat.co.uk>
Date: Tue, 8 May 2012 19:10:24 +0000 (+0000)
Subject: MountPoints probe tests
X-Git-Tag: v0.001_001~113
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=daf4840072ac391eb6d3f815f63202c50991db62;p=scpubgit%2FSystem-Introspector.git

MountPoints probe tests
---

diff --git a/t/mountpoints.t b/t/mountpoints.t
new file mode 100644
index 0000000..4f3428e
--- /dev/null
+++ b/t/mountpoints.t
@@ -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;