Code-TidyAll
view release on metacpan or search on metacpan
t/lib/TestFor/Code/TidyAll/SpacesInPaths.pm view on Meta::CPAN
package TestFor::Code::TidyAll::SpacesInPaths;
use strict;
use warnings;
use Test::Class::Most parent => 'TestFor::Code::TidyAll::Plugin';
use Code::TidyAll::Plugin::PerlCritic;
use Code::TidyAll::Util qw(tempdir_simple);
use Module::Runtime qw( require_module );
use Path::Tiny qw( cwd );
use Try::Tiny;
BEGIN {
my @mods
= qw( Mason::Tidy Perl::Critic Perl::Tidy Perl::Tidy::Sweetened Pod::Checker Pod::Tidy );
push @mods, 'Pod::Spell'
unless $^O eq 'MSWin32';
for my $mod (@mods) {
unless ( try { require_module($mod); 1 } ) {
__PACKAGE__->SKIP_CLASS("This test requires the $mod module");
return;
}
}
}
sub _extra_path {
my $cwd = cwd();
return (
$cwd->child(qw( node_modules .bin )),
$cwd->child(qw( php5 usr bin )),
);
}
sub test_css_unminifier : Tests {
my $self = shift;
return unless $self->require_executable('node');
return unless $self->require_executable('cssunminifier');
my $file = $self->_spaces_dir->child('foo bar.css');
my $source = "body {\nfont-family:helvetica;\nfont-size:15pt;\n}";
$file->spew($source);
$self->tidyall(
plugin_conf => {
CSSUnminifier => { select => '**/*.css' },
},
source_file => $file,
expect_tidy => "body {\n font-family: helvetica;\n font-size: 15pt;\n}\n"
);
}
sub test_js_plugins : Tests {
my $self = shift;
return unless $self->require_executable('node');
return unless $self->require_executable('js-beautify');
return unless $self->require_executable('jshint');
return unless $self->require_executable('jslint');
my $file = $self->_spaces_dir->child('foo bar.js');
$file->spew('var my_object = {};');
$self->tidyall(
plugin_conf => {
JSBeautify => { select => '**/*.js' },
JSHint => { select => '**/*.js' },
JSLint => { select => '**/*.js' },
},
source_file => $file,
( run in 0.736 second using v1.01-cache-2.11-cpan-39bf76dae61 )