Hosts probe tests
Robert 'phaylon' Sedlacek [Tue, 8 May 2012 18:45:58 +0000 (18:45 +0000)]
t/data/hosts [new file with mode: 0644]
t/hosts.t [new file with mode: 0644]

diff --git a/t/data/hosts b/t/data/hosts
new file mode 100644 (file)
index 0000000..1711790
--- /dev/null
@@ -0,0 +1,4 @@
+1.2.3.4 foo bar
+
+# another one
+2.3.4.5 bar
diff --git a/t/hosts.t b/t/hosts.t
new file mode 100644 (file)
index 0000000..ed6c1e9
--- /dev/null
+++ b/t/hosts.t
@@ -0,0 +1,16 @@
+use strictures 1;
+use Test::More;
+use FindBin;
+
+use System::Introspector::Hosts;
+
+my $probe = System::Introspector::Hosts->new(
+    hosts_file => "$FindBin::Bin/data/hosts",
+);
+my $data  = $probe->gather;
+
+is_deeply $data,
+    [['1.2.3.4', qw( foo bar )], ['2.3.4.5', 'bar']],
+    'parsing worked';
+
+done_testing;