mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-03-12 04:07:01 -04:00
Test thru perltidy.
This commit is contained in:
parent
938098cd74
commit
4d1d1a2832
10 changed files with 38 additions and 18 deletions
|
@ -20,7 +20,7 @@ install:
|
|||
- SET PERL_MB_OPT=--install_base C:/_P5
|
||||
- SET PERL_MM_OPT=INSTALL_BASE=C:/_P5
|
||||
- perl -v
|
||||
- cpanm --notest File::Find::Object Task::FreecellSolver::Testing Test::TrailingSpace
|
||||
- cpanm --notest File::Find::Object Perl::Tidy Task::FreecellSolver::Testing Test::Code::TidyAll Test::TrailingSpace
|
||||
- echo %PATH%
|
||||
build: off
|
||||
test_script:
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
*.pyc
|
||||
.tidyall.d/
|
||||
MANIFEST
|
||||
build/*
|
||||
data/cardsets/*
|
||||
|
|
3
.perltidyrc
Normal file
3
.perltidyrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
-ci=4
|
||||
-bl
|
||||
-cti=0
|
4
.tidyallrc
Normal file
4
.tidyallrc
Normal file
|
@ -0,0 +1,4 @@
|
|||
[PerlTidy]
|
||||
argv = -ci=4 -bl -cti=0
|
||||
ignore = **/{cmpdigest,valgrind,verify}--*.t
|
||||
select = **/*.{pl,pm,t}
|
|
@ -5,7 +5,7 @@ before_install:
|
|||
- sudo apt-get install -y ack-grep cpanminus libperl-dev make perl python-glade2 python-gnome2 python-gnome2-dev python-gtk2 python-setuptools python-tk python3 python3-pip python3-setuptools python3-tk
|
||||
- sudo dpkg-divert --local --divert /usr/bin/ack --rename --add /usr/bin/ack-grep
|
||||
install:
|
||||
- sudo cpanm Test::Differences Test::TrailingSpace
|
||||
- sudo cpanm Perl::Tidy Test::Code::TidyAll Test::Differences Test::TrailingSpace
|
||||
- "`which python3` -m pip install --upgrade --user flake8 random2 six"
|
||||
- "sudo /usr/bin/python3 -m pip install --upgrade random2 six"
|
||||
- "`which python` -m pip install --upgrade --user random2 six"
|
||||
|
|
13
run-tests.pl
13
run-tests.pl
|
@ -53,14 +53,13 @@ sub run_tests
|
|||
{
|
||||
require Test::Run::CmdLine::Prove;
|
||||
|
||||
my $p =
|
||||
Test::Run::CmdLine::Prove->create(
|
||||
my $p = Test::Run::CmdLine::Prove->create(
|
||||
{
|
||||
'args' => [@$tests],
|
||||
'args' => [@$tests],
|
||||
'env_switches' => $ENV{'PROVE_SWITCHES'},
|
||||
}
|
||||
);
|
||||
exit(! $p->run());
|
||||
exit( !$p->run() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +86,7 @@ sub myglob
|
|||
local $ENV{FCS_PATH} = $fcs_path;
|
||||
local $ENV{FCS_SRC_PATH} = $abs_bindir;
|
||||
|
||||
local $ENV{FREECELL_SOLVER_QUIET} = 1;
|
||||
local $ENV{FREECELL_SOLVER_QUIET} = 1;
|
||||
Env::Path->PATH->Prepend(
|
||||
File::Spec->catdir( Cwd::getcwd(), "board_gen" ),
|
||||
File::Spec->catdir( $abs_bindir, "t", "scripts" ),
|
||||
|
@ -157,11 +156,11 @@ sub myglob
|
|||
|
||||
my @tests =
|
||||
sort { ( basename($a) cmp basename($b) ) || ( $a cmp $b ) }
|
||||
( myglob("$abs_bindir/tests/*") );
|
||||
( myglob("$abs_bindir/tests/*") );
|
||||
|
||||
if ($IS_WIN)
|
||||
{
|
||||
@tests = grep {not (/pysolgtk/i or /import_v2/i)} @tests;
|
||||
@tests = grep { not( /pysolgtk/i or /import_v2/i ) } @tests;
|
||||
}
|
||||
|
||||
if ( defined($exclude_re_s) )
|
||||
|
|
|
@ -8,17 +8,17 @@ use List::MoreUtils qw(none);
|
|||
|
||||
my @m2;
|
||||
L_LOOP:
|
||||
foreach my $l (io("scripts/gen_individual_importing_tests.py")->getlines())
|
||||
foreach my $l ( io("scripts/gen_individual_importing_tests.py")->getlines() )
|
||||
{
|
||||
if ($l =~ m/^for module_name/)
|
||||
if ( $l =~ m/^for module_name/ )
|
||||
{
|
||||
my @ms = $l =~ m{('pysollib\.[^']+')}g;
|
||||
@m2 = (map { $_ =~ s/\A'//r =~ s/\'\z//r =~ tr#.#/#r } @ms);
|
||||
@m2 = ( map { $_ =~ s/\A'//r =~ s/\'\z//r =~ tr#.#/#r } @ms );
|
||||
last L_LOOP;
|
||||
}
|
||||
}
|
||||
|
||||
while (my $l = <STDIN>)
|
||||
while ( my $l = <STDIN> )
|
||||
{
|
||||
chomp($l);
|
||||
print "$l\n" if none { $l =~ /$_/ } @m2;
|
||||
|
|
14
tests/style/perltidy.t
Normal file
14
tests/style/perltidy.t
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
if ( $ENV{FCS_TEST_SKIP_PERLTIDY} )
|
||||
{
|
||||
require Test::More;
|
||||
Test::More::plan( 'skip_all' =>
|
||||
"Skipping perltidy test because FCS_TEST_SKIP_PERLTIDY was set" );
|
||||
}
|
||||
require Test::Code::TidyAll;
|
||||
|
||||
Test::Code::TidyAll::tidyall_ok( conf_file => ".tidyallrc", );
|
|
@ -9,7 +9,7 @@ use Test::Differences qw( eq_or_diff );
|
|||
use File::Find::Object ();
|
||||
use String::ShellQuote qw/ shell_quote /;
|
||||
|
||||
if ($^O =~ /\AMSWin/)
|
||||
if ( $^O =~ /\AMSWin/ )
|
||||
{
|
||||
plan skip_all => "command line exceeded on ms windows.";
|
||||
}
|
||||
|
|
|
@ -18,12 +18,11 @@ else
|
|||
my $finder = Test::TrailingSpace->new(
|
||||
{
|
||||
root => '.',
|
||||
filename_regex => qr/(?:(?:\.(?:t|pm|pl|PL|yml|json|arc|vim|py|tcl))|README(?:\.md)?|Changes|LICENSE|MANIFEST|AUTHORS|COPYING)\z/,
|
||||
filename_regex =>
|
||||
qr/(?:(?:\.(?:t|pm|pl|PL|yml|json|arc|vim|py|tcl))|README(?:\.md)?|Changes|LICENSE|MANIFEST|AUTHORS|COPYING)\z/,
|
||||
},
|
||||
);
|
||||
|
||||
# TEST
|
||||
$finder->no_trailing_space(
|
||||
"No trailing space was found."
|
||||
);
|
||||
$finder->no_trailing_space("No trailing space was found.");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue