diff --git a/t/00_diag.t b/t/00_diag.t index 95a9745..02edd81 100644 --- a/t/00_diag.t +++ b/t/00_diag.t @@ -1,5 +1,6 @@ use strict; use warnings; +use Config; use Test::More tests => 1; BEGIN { my @modules; @@ -18,6 +19,13 @@ BEGIN { eval qq{ require $_ } for @modules; }; +sub spacer () +{ + diag ''; + diag ''; + diag ''; +} + pass 'okay'; my @modules; @@ -33,9 +41,30 @@ my $max = 1; $max = $_ > $max ? $_ : $max for map { length $_ } @modules; our $format = "%-${max}s %s"; -diag ''; -diag ''; -diag ''; +spacer; + +my @keys = sort grep /(MOJO|PERL|\A(LC|HARNESS)_|\A(SHELL|LANG)\Z)/i, keys %ENV; + +if(@keys > 0) +{ + diag "$_=$ENV{$_}" for @keys; + + if($ENV{PERL5LIB}) + { + spacer; + diag "PERL5LIB path"; + diag $_ for split $Config{path_sep}, $ENV{PERL5LIB}; + + } + elsif($ENV{PERLLIB}) + { + spacer; + diag "PERLLIB path"; + diag $_ for split $Config{path_sep}, $ENV{PERLLIB}; + } + + spacer; +} diag sprintf $format, 'perl ', $^V; @@ -56,6 +85,5 @@ foreach my $module (@modules) } } -diag ''; -diag ''; -diag ''; +spacer; + diff --git a/t/00_diag.txt b/t/00_diag.txt index aa16458..7254e8a 100644 --- a/t/00_diag.txt +++ b/t/00_diag.txt @@ -10,7 +10,6 @@ Mojolicious::Lite POSIX Template Template::Provider -Test::CPAN::Meta Test::Mojo Test::More lib diff --git a/xt/release/build_environment.t b/xt/release/build_environment.t index 82bb61c..bdc44d8 100644 --- a/xt/release/build_environment.t +++ b/xt/release/build_environment.t @@ -5,5 +5,5 @@ use Test::More tests => 1; SKIP: { eval q{ use Dist::Zilla::PluginBundle::Author::Plicease }; skip '[@Plicease] is not installed', 1 if $@; - ok $Dist::Zilla::PluginBundle::Author::Plicease::VERSION >= 0.7, '[@Plicease] >= 0.7'; + ok $Dist::Zilla::PluginBundle::Author::Plicease::VERSION >= 1.45, '[@Plicease] >= 1.45'; } diff --git a/xt/release/pod_coverage.t b/xt/release/pod_coverage.t index 7095883..af899c0 100644 --- a/xt/release/pod_coverage.t +++ b/xt/release/pod_coverage.t @@ -20,6 +20,8 @@ my $config; $config = LoadFile($config_filename) if -r $config_filename; +plan skip_all => 'disabled' if $config->{pod_coverage}->{skip}; + chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); my @private_classes; diff --git a/xt/release/pod_spelling_system.t b/xt/release/pod_spelling_system.t index eac020c..3773353 100644 --- a/xt/release/pod_spelling_system.t +++ b/xt/release/pod_spelling_system.t @@ -20,6 +20,8 @@ my $config; $config = LoadFile($config_filename) if -r $config_filename; +plan skip_all => 'disabled' if $config->{pod_spelling_system}->{skip}; + chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); add_stopwords(@{ $config->{pod_spelling_system}->{stopwords} }); @@ -29,6 +31,7 @@ all_pod_files_spelling_ok; __DATA__ Plicease stdout +stderr stdin subref loopback @@ -37,3 +40,62 @@ os Ollis Mojolicious plicease +CPAN +reinstall +TODO +filename +filenames +login +callback +callbacks +standalone +VMS +hostname +hostnames +TCP +UDP +IP +API +MSWin32 +OpenBSD +FreeBSD +NetBSD +unencrypted +WebSocket +WebSockets +timestamp +timestamps +poney +BackPAN +portably +RedHat +AIX +BSD +XS +FFI +perlish +optimizations +subdirectory +RESTful +SQLite +JavaScript +dir +plugins +munge +jQuery +namespace +PDF +PDFs +usernames +DBI +pluggable +APIs +SSL +JSON +YAML +uncommented +Solaris +OpenVMS +URI +URL +CGI diff --git a/xt/release/unused_vars.t b/xt/release/unused_vars.t new file mode 100644 index 0000000..b492ce1 --- /dev/null +++ b/xt/release/unused_vars.t @@ -0,0 +1,63 @@ +use strict; +use warnings; +use Test::More; +BEGIN { plan skip_all => 'test requires Test::Vars ' unless eval q{ use Test::Vars; 1 } } +BEGIN { plan skip_all => 'test requires Path::Class' unless eval q{ use Path::Class::Dir; 1 } } +BEGIN { plan skip_all => 'test requires YAML' unless eval q{ use YAML; 1 } } + +my $dir = Path::Class::Dir->new(__FILE__)->parent->parent->parent; +my $config = YAML::LoadFile($dir->file(qw( xt release release.yml ))); + +plan skip_all => 'disabled' if $config->{unused_vars}->{skip}; + +my @modules; +recurse($dir->subdir('lib')); + +sub recurse +{ + my $dir = shift; + foreach my $child ($dir->children) + { + if($child->is_dir) + { + recurse($child); + } + else + { + push @modules, $child if $child->basename =~ /\.pm$/; + } + } +} + +plan tests => scalar @modules; + +my %global = ( + ignore_vars => { map { $_ => 1 } @{ $config->{unused_vars}->{global}->{ignore_vars} } }, +); +if(defined $config->{unused_vars}->{global}->{ignore_if}) +{ + $global{ignore_if} = eval $config->{unused_vars}->{global}->{ignore_if}; + die $@ if $@; +} + +foreach my $file (@modules) +{ + my @mod = $file->components; + shift @mod; # get rid of '.'; + shift @mod; # get rid of 'lib'; + $mod[-1] =~ s/\.pm$//; + my $mod = join '::', @mod; + + my %local = %global; + foreach my $ignore (@{ $config->{unused_vars}->{module}->{$mod}->{ignore_vars} || []}) + { + $local{ignore_vars}->{$ignore} = 1; + } + if(defined $config->{unused_vars}->{module}->{$mod}->{ignore_if}) + { + $local{ignore_if} = eval $config->{unused_vars}->{module}->{$mod}->{ignore_if}; + die $@ if $@; + } + + vars_ok($file, %local); +}