01-pptest.t (PDL-2.080) | : | 01-pptest.t (PDL-2.081) | ||
---|---|---|---|---|
skipping to change at line 238 | skipping to change at line 238 | |||
Code => ';', # do nothing | Code => ';', # do nothing | |||
); | ); | |||
# test XS args with funky Pars ordering | # test XS args with funky Pars ordering | |||
pp_deft('polyfill_pp', | pp_deft('polyfill_pp', | |||
Pars => 'int [o,nc] im(m,n); float ps(two=2,np); int col()', | Pars => 'int [o,nc] im(m,n); float ps(two=2,np); int col()', | |||
Code => ';', # do nothing | Code => ';', # do nothing | |||
); | ); | |||
# test valid non-single-letter GenericTypes arg | # test valid non-single-letter GenericTypes arg | |||
pp_def( "rice_compress", | pp_deft("rice_compress", | |||
Pars => 'in(n); [o]out(m); int[o]len(); lbuf(n)', | Pars => 'in(n); [o]out(m); int[o]len(); lbuf(n)', | |||
GenericTypes =>['B','S','US','L'], | GenericTypes =>['B','S','US','L'], | |||
Code => ';', # do nothing | Code => ';', # do nothing | |||
); | ); | |||
pp_deft('output_op', | ||||
Pars => 'in(n=2)', | ||||
OtherPars => '[o] PDL_Anyval v0; [o] PDL_Anyval v1', | ||||
Code => ' | ||||
pdl_datatypes dt = $PDL(in)->datatype; | ||||
ANYVAL_FROM_CTYPE($COMP(v0), dt, $in(n=>0)); | ||||
ANYVAL_FROM_CTYPE($COMP(v1), dt, $in(n=>1)); | ||||
', | ||||
); | ||||
pp_deft('output_op2', | ||||
Pars => 'in(n=2); [o] out()', | ||||
OtherPars => '[o] PDL_Anyval v0; [o] PDL_Anyval v1', | ||||
Code => ' | ||||
pdl_datatypes dt = $PDL(in)->datatype; | ||||
ANYVAL_FROM_CTYPE($COMP(v0), dt, $in(n=>0)); | ||||
ANYVAL_FROM_CTYPE($COMP(v1), dt, $in(n=>1)); | ||||
', | ||||
); | ||||
pp_done; | pp_done; | |||
# this tests the bug with a trailing comment and *no* newline | # this tests the bug with a trailing comment and *no* newline | |||
EOF | EOF | |||
't/all.t' => <<'EOF', | 't/all.t' => <<'EOF', | |||
use strict; | use strict; | |||
use warnings; | use warnings; | |||
use Test::More; | use Test::More; | |||
use Test::Warn; | use Test::Warn; | |||
skipping to change at line 371 | skipping to change at line 390 | |||
ok( tapprox( $got, $exp ), "continue works in broadcastloop" ) | ok( tapprox( $got, $exp ), "continue works in broadcastloop" ) | |||
or do { diag "got : $got"; diag "expected: $exp" }; | or do { diag "got : $got"; diag "expected: $exp" }; | |||
} | } | |||
test_Cpow(sequence(2), 1); | test_Cpow(sequence(2), 1); | |||
test_polyfill_pp(zeroes(5,5), ones(2,3), 1); | test_polyfill_pp(zeroes(5,5), ones(2,3), 1); | |||
is test_succ(2)."", 3, 'test pp_add_macros works'; | is test_succ(2)."", 3, 'test pp_add_macros works'; | |||
test_output_op([5,7], my $v0, my $v1); | ||||
is_deeply [$v0,$v1], [5,7], 'output OtherPars work'; | ||||
eval { test_output_op(sequence(2,3), my $v0, my $v1) }; | ||||
isnt $@, '', 'broadcast with output OtherPars throws'; | ||||
test_output_op2([5,7], my $v0_2, my $v1_2); | ||||
is_deeply [$v0_2,$v1_2], [5,7], 'output OtherPars work 2'; | ||||
eval { test_output_op2(sequence(2,3), my $v0_2, my $v1_2) }; | ||||
isnt $@, '', 'broadcast with output OtherPars throws 2'; | ||||
done_testing; | done_testing; | |||
EOF | EOF | |||
); | ); | |||
my %BADOTHERPARSFILES = ( | my %BADOTHERPARSFILES = ( | |||
'Makefile.PL' => <<'EOF', | 'Makefile.PL' => <<'EOF', | |||
use strict; | use strict; | |||
use warnings; | use warnings; | |||
use ExtUtils::MakeMaker; | use ExtUtils::MakeMaker; | |||
skipping to change at line 540 | skipping to change at line 569 | |||
EOF | EOF | |||
); | ); | |||
do_tests(\%THREADTESTFILES); | do_tests(\%THREADTESTFILES); | |||
do_tests(\%PPTESTFILES); | do_tests(\%PPTESTFILES); | |||
do_tests(\%BADOTHERPARSFILES, qr/Invalid OtherPars name/); | do_tests(\%BADOTHERPARSFILES, qr/Invalid OtherPars name/); | |||
do_tests(\%BADPARSFILES, qr/Invalid Pars name/); | do_tests(\%BADPARSFILES, qr/Invalid Pars name/); | |||
sub do_tests { | sub do_tests { | |||
my ($hash, $error_re) = @_; | my ($hash, $error_re, $dir) = @_; | |||
in_dir( | in_dir( | |||
sub { | sub { | |||
hash2files(File::Spec->curdir, $hash); | hash2files(File::Spec->curdir, $hash); | |||
local $ENV{PERL5LIB} = join $Config{path_sep}, @INC; | local $ENV{PERL5LIB} = join $Config{path_sep}, @INC; | |||
run_ok(qq{"$^X" Makefile.PL}); | run_ok(qq{"$^X" Makefile.PL}); | |||
run_ok(qq{"$Config{make}" test}, $error_re); | run_ok(qq{"$Config{make}" test}, $error_re); | |||
}, | }, | |||
$dir, | ||||
); | ); | |||
} | } | |||
sub run_ok { | sub run_ok { | |||
my ($cmd, $error_re) = @_; | my ($cmd, $error_re) = @_; | |||
my $res = run(command => $cmd, buffer => \my $buffer); | my $res = run(command => $cmd, buffer => \my $buffer); | |||
if ($error_re) { | if ($error_re) { | |||
ok !$res, 'Fails to build if invalid'; | ok !$res, 'Fails to build if invalid'; | |||
like $buffer, $error_re, 'Fails with expected error'; | like $buffer, $error_re, 'Fails with expected error'; | |||
return; | return; | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 32 lines changed or added |