Move author-only tests to xt directory

so they aren't run on installation by users
This commit is contained in:
Alexander Hartmaier
2016-04-27 17:49:26 +02:00
parent 7deea96bc3
commit f901ba5591
8 changed files with 5 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
#!/usr/bin/perl
# 00_local_distribution.t - Private test to check distribution
# $Id$
use strict;
use warnings;
use Test::More;
eval { require Test::Distribution; };
plan skip_all => 'Optional Test::Distribution not installed' if ($@);
# Skip POD tests as we will test separately
import Test::Distribution not => [ qw/pod podcover/ ];

46
xt/00_local_docininfo.t Normal file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/perl
# 00_local_versionsync.t - Private test to check that all modules are listed in Info.pm
# $Id$
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,"blib/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}, 'blib');
sub check_version {
# $_ is the full path to the file
return unless (m{blib/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($_);
}

12
xt/00_local_perlcritic.t Normal file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/perl
# 00_local_perlcritic.t - Test file for PBP compliance for SNMP::Info
# $Id$
use strict;
use warnings;
use Test::More;
eval "use Test::Perl::Critic (-severity => 5)";
plan skip_all => "Test::Perl::Critic required for testing PBP compliance" if $@;
Test::Perl::Critic::all_critic_ok();

View File

@@ -0,0 +1,22 @@
#!/usr/bin/perl
# pod-coverage.t - Test to check POD coverage of SNMP::Info
# $Id$
use strict;
use warnings;
use Test::More;
# Ensure a recent version of Test::Pod::Coverage
my $min_tpc = 1.08;
eval "use Test::Pod::Coverage $min_tpc";
plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
if $@;
# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
# but older versions don't recognize some common documentation styles
my $min_pc = 0.18;
eval "use Pod::Coverage $min_pc";
plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
if $@;
all_pod_coverage_ok();

14
xt/00_local_pod.t Normal file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/perl
# pod.t - Test to check for POD errors in SNMP::Info
# $Id$
use strict;
use warnings;
use Test::More;
# Ensure a recent version of Test::Pod
my $min_tp = 1.22;
eval "use Test::Pod $min_tp";
plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
all_pod_files_ok();

352
xt/00_local_spelling.t Normal file
View File

@@ -0,0 +1,352 @@
#!/usr/bin/perl
# 00_local_spelling.t - Private test to spell check documentation
# $Id$
use warnings;
use strict;
use Test::More;
eval "use Test::Spelling";
plan skip_all => "Test::Spelling required for checking spelling"
if $@;
set_spell_cmd('aspell list');
add_stopwords(<DATA>);
all_pod_files_spelling_ok();
__DATA__
5000BH
accelar
acl
actial
adsl
ADSL
af
agere
airespace
aironet
airos
alcatel
Alcatel
alteon
altiga
Altiga
AMAP
anycast
AOS
ap
APC
APs
arista
Arista
arn
arp
aruba
asa
asante
ascii
asn
ati
attr
ATUC
ATUR
augenstein
autonegotiate
autospecify
avaya
Avaya
baetz
Barthel
bayrs
baystack
bcn
begemot
Bernhard
bes
bgp
bigint
bigiron
Binks
bitmask
bladecenter
bln
bpdus
BSSID
bulkrepeaters
bulkwalk
Bulley
cabletron
casted
catos
cdp
centillion
CER
CES
circuitless
cisco
cisco's
ciscovtp
citrix
Citrix
cli
concentrators
conf
config
contivity
CPAN
CPE
cpu
ctron
CVTA
cyclades
DataSMART
datatype
De
deauthenticate
debugsnmp
dhcp
dlink
dmitry
DOCSIS
DRG
ds
dslam
dslams
dsss
dynamicgvrp
eapol
edgeiron
eigrp
enterasys
EOS
erszenyi
ess
ESXi
etherlike
ethernet
EvolutionOS
extranet
fastiron
fdb
fdp
fenner
fixups
fortinet
Fortinet
fortios
FreeBSD
FS
fsm
FTOS
fwsm
FWSM
gbe
gbesm
Gbps
getnext
Ghz
gigabit
Gorwits
hartmaier
huawei
Huawei
iana
ibm
icf
ieee
ietf
ifindex
ifStackTable
igmp
IgnoreNetSNMPConf
iid
iids
indices
ingen
InLoopback
ios
IOS
ip
IPv
IPV
ISID
jeroen
junos
Kentrox
Kosmach
kramarov
Kraus
ladvd
lans
lantronix
Lantronix
linksys
lldp
loopback
loopdetect
lorensen
lsb
lucent
Lucent
luiggi
lwapp
macfilter
mau
maxrepeaters
mbs
mckeown
mda
MERCHANTABILITY
mib
MIB
mibdirs
mibs
Mikrotik
milliwatts
MLT
MLX
MLXe
msb
mtu
multi
multicast
multimode
multiNode
multiseg
multivlan
munge
munges
namespace
ndp
netdisco
netgear
NetIron
netmask
netscaler
Netscaler
netscreen
Nic
Nicolai
nmm
nopassword
nortel
nosuch
NX
oem
ofdm
oid
oids
OmniSwitch
OO
os
osi
ospf
overridable
PacketFront
pae
PAgP
Palo
petri
pfSense
phy
pinkoski
poe
pov
powerconnect
PPI
procurve
propvirtual
proxim
PSE
pvid
PVST
qbridge
qos
queueing
Quidway
Rackswitch
radlan
radware
Radware
Ralf
rapidcity
readme
readonly
rebranded
retreved
retrynosuch
Robbert
rom
ros
RouterOS
rtt
rttmon
sca
Schenau
sergienko
SG
sieborger
Smartport
snmp
SNMP
SNMP's
snmpv2
snmpv3
snmpwalk
solaris
SonicWALL
sonmp
Sourceforge
SPBM
ssid
SSIDs
SSID's
SSL
stackable
stdout
steelhead
stg
Stickland
stp
subclassesand
subcomponents
subnet
sunos
supply's
synoptics
sys
Telesis
telesyn
telesys
terabit
tftp
tftpfilename
tftpserver
TiMOS
tmnxModel
todo
tuttle
Ubiquiti
ucsc
UDP
unicast
uninstall
untagged
uptime
vlan
vlans
VMware
VoIP
VPC
vpn
VRP
VSP
VSS
vtp
watanabe
wlan
wlans
WS
XMR
zoltan
zyxel

45
xt/00_local_versionsync.t Normal file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/perl
# 00_local_versionsync.t - Private test to check all version numbers match
# $Id$
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 $last_version = undef;
find({wanted => \&check_version, no_chdir => 1}, 'blib');
if (! defined $last_version) {
fail('Failed to find any files with $VERSION');
}
sub check_version {
# $_ is the full path to the file
return if (! m{blib/script/}xms && ! m{\.pm \z}xms);
my $content = read_file($_);
# only look at perl scripts, not sh scripts
return if (m{blib/script/}xms && $content !~ m/\A \#![^\r\n]+?perl/xms);
my @version_lines = $content =~ m/ ( [^\n]* \$VERSION\s= [^\n]* ) /gxms;
if (@version_lines == 0) {
fail($_);
}
for my $line (@version_lines) {
if (!defined $last_version) {
$last_version = shift @version_lines;
pass($_);
}
else {
is($line, $last_version, $_);
}
}
}