Commit | Line | Data |
6bc93875 |
1 | use strictures 1; |
2 | use Test::More; |
3 | use FindBin; |
4 | |
afd7c030 |
5 | use System::Introspector::Probe::Hosts; |
6bc93875 |
6 | |
afd7c030 |
7 | my $probe = System::Introspector::Probe::Hosts->new( |
6bc93875 |
8 | hosts_file => "$FindBin::Bin/data/hosts", |
9 | ); |
505ca707 |
10 | |
11 | my $result = $probe->gather; |
12 | ok $result, 'received data'; |
5a9311b3 |
13 | my $data = $result->{hosts_file}; |
505ca707 |
14 | ok $data, 'received hosts data'; |
6bc93875 |
15 | |
5a9311b3 |
16 | is $result->{__error__}, undef, 'no errors'; |
17 | ok $data->{file_name}, 'received file name'; |
18 | |
19 | my $body = $data->{body}; |
20 | ok $body, 'received a body'; |
21 | like $body, qr{1.2.3.4\s+foo\s+bar}, 'first host'; |
22 | like $body, qr{2.3.4.5\s+bar}, 'second host'; |
23 | like $body, qr{some comment}, 'comment preserved'; |
6bc93875 |
24 | |
25 | done_testing; |