Files
snmp-info/xt/00_local_docininfo.t
nick n 3bcc522590 documentation overhaul (#353)
* ident
* remove $Id$ tags from rcs software which has been retired
* make an effort to sync required mib docs with actual code
* sync even more docs with what code actually does
* some whitespace nits
* fixup example to use snmpv2 for all but the most ancient devices
* remove blurb to find more specific snmp::info classes for classes
  which alrdy are as specific as they can get (eg snmp::info::layer3::vmware
  doesn't need info on to find a specific module since there ain't none)
* rename all sub {vendor} strings to lowercase vendor, if cisco, juniper
  and arista can be lowercase, so can be all the rest.
* fix tests
* spread some use warnings around
* use $ instead of @
* remove defines that are included via parent classes
* use strict + warnings
* remove alrdy included modules
* add comma after last list item
* typos
* mibs are found in our mib repo, not on the cisco site
* documentation fixes
2019-08-25 06:47:10 +02:00

46 lines
1.0 KiB
Perl

#!/usr/bin/env perl
# 00_local_versionsync.t - Private test to check that all modules are listed in Info.pm
use warnings;
use strict;
use File::Find;
use Test::More;
eval "use File::Slurp";
plan skip_all => "File::Slurp required for testing version sync"
if $@;
plan qw(no_plan);
my %Items;
# Grab all the =item's from Info.pm
open (I,"lib/SNMP/Info.pm") or fail("Can't open Info.pm");
while (<I>) {
next unless /^\s*=item\s*(\S+)/;
$Items{$1}++;
}
close I;
#warn "items : ",join(', ',keys %Items),"\n";
# Check that each package is represented in Info.pm docs
find({wanted => \&check_version, no_chdir => 1}, 'lib');
sub check_version {
# $_ is the full path to the file
return unless (m{lib/}xms and m{\.pm \z}xms);
my $content = read_file($_);
# Make sure that this package is listed in Info.pm
fail($_) unless $content =~ m/^\s*package\s+(\S+)\s*;/m;
my $package = $1;
return if $package eq 'SNMP::Info';
fail($_) unless defined $Items{$package};
pass($_);
}