--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/t/00-basic.t Wed Jun 01 00:16:29 2016 +0200
@@ -0,0 +1,24 @@
+use Test::More qw(no_plan);
+use Test::Exception;
+
+use_ok 'Nagios::Check::DNS::check_tlsa_record';
+can_ok 'Nagios::Check::DNS::check_tlsa_record', qw(dig_tlsa);
+
+# The above package doesn't use the Exporter currently, for shortcut
+# reasons we import the relevant subs into *this* module
+*dig_tlsa = \&Nagios::Check::DNS::check_tlsa_record::dig_tlsa;
+
+# API conformance
+subtest 'API' => sub {
+ can_ok 'Nagios::Check::DNS::check_tlsa_record', qw(dig_tlsa);
+ dies_ok { dig_tlsa('example.org') } 'API: dig_tlsa() missing port';
+};
+
+# get and compare the TLSA records via dig_tlsa with `dig …`
+subtest 'Data' => sub {
+ foreach (['ssl.schlittermann.de' => 443], ['mx1.mailbox.org.de' => 25],) {
+ my ($domain, $port) = @$_;
+ is dig_tlsa($domain, $port),
+ `dig +short tlsa _$port._tcp.$domain` => "TLSA $domain:$port";
+ }
+};