From b822859eb56a42c7af3fd8638f2765affe900afa Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Tue, 8 Jan 2019 16:56:43 -0800 Subject: [PATCH] added test snippets for recent code updates --- t/snippets/expect/gnu5.def | 7 ++ t/snippets/expect/gnu5.gnu | 7 ++ t/snippets/expect/kgb_tight.def | 86 +++++++++++++ t/snippets/expect/wn2.wn | 10 +- t/snippets/expect/wn5.wn | 18 +-- t/snippets/expect/wngnu1.def | 17 +++ t/snippets/gnu5.in | 7 ++ t/snippets/kgb_tight.def | 1 + t/snippets/kgb_tight.in | 87 +++++++++++++ t/snippets/packing_list.txt | 8 +- t/snippets/wngnu1.in | 17 +++ t/snippets/wngun.par | 1 + t/snippets12.t | 28 ++--- t/snippets14.t | 209 ++++++++++++++++++++++++++++++++ t/snippets15.t | 158 ++++++++++++++++++++++++ 15 files changed, 631 insertions(+), 30 deletions(-) create mode 100644 t/snippets/expect/gnu5.def create mode 100644 t/snippets/expect/gnu5.gnu create mode 100644 t/snippets/expect/kgb_tight.def create mode 100644 t/snippets/expect/wngnu1.def create mode 100644 t/snippets/gnu5.in create mode 100644 t/snippets/kgb_tight.def create mode 100644 t/snippets/kgb_tight.in create mode 100644 t/snippets/wngnu1.in create mode 100644 t/snippets/wngun.par create mode 100644 t/snippets15.t diff --git a/t/snippets/expect/gnu5.def b/t/snippets/expect/gnu5.def new file mode 100644 index 00000000..9edd87fa --- /dev/null +++ b/t/snippets/expect/gnu5.def @@ -0,0 +1,7 @@ + # side comments limit gnu type formatting with l=80; note extra comma + push @tests, [ + "Lowest code point requiring 13 bytes to represent", # 2**36 + "\xff\x80\x80\x80\x80\x80\x81\x80\x80\x80\x80\x80\x80", + ($::is64bit) ? 0x1000000000 : -1, # overflows on 32bit + ], + ; diff --git a/t/snippets/expect/gnu5.gnu b/t/snippets/expect/gnu5.gnu new file mode 100644 index 00000000..9bd9c418 --- /dev/null +++ b/t/snippets/expect/gnu5.gnu @@ -0,0 +1,7 @@ + # side comments limit gnu type formatting with l=80; note extra comma + push @tests, [ + "Lowest code point requiring 13 bytes to represent", # 2**36 + "\xff\x80\x80\x80\x80\x80\x81\x80\x80\x80\x80\x80\x80", + ($::is64bit) ? 0x1000000000 : -1, # overflows on 32bit + ], + ; diff --git a/t/snippets/expect/kgb_tight.def b/t/snippets/expect/kgb_tight.def new file mode 100644 index 00000000..f3fcd35e --- /dev/null +++ b/t/snippets/expect/kgb_tight.def @@ -0,0 +1,86 @@ +# a variety of line types for testing -kgb +use strict; +use Test; +use Encode qw(from_to encode decode + encode_utf8 decode_utf8 + find_encoding is_utf8); + +use charnames qw(greek); +our $targetdir = "/usr/local/doc/HTML/Perl"; + +local ( + $tocfile, $loffile, $lotfile, $footfile, + $citefile, $idxfile, $figure_captions, $table_captions, + $footnotes, $citations, %font_size, %index, + %done, $t_title, $t_author, $t_date, + $t_address, $t_affil, $changed +); +my @UNITCHECKs = + B::unitcheck_av->isa("B::AV") + ? B::unitcheck_av->ARRAY + : (); + +my @CHECKs = B::check_av->isa("B::AV") ? B::check_av->ARRAY : (); +my $dna = Bio::LiveSeq::DNA->new( -seq => $dnasequence ); +my $min = 1; +my $max = length($dnasequence); +my $T = $G->_strongly_connected; + +my %R = $T->vertex_roots; +my @C; # We're not calling the strongly_connected_components() + # Do not separate this hanging side comment from previous + +my $G = shift; + +my $exon = Bio::LiveSeq::Exon->new( + -seq => $dna, + -start => $min, + -end => $max, + -strand => 1 +); +my @inputs = ( + 0777, 0700, 0470, 0407, 0433, 0400, 0430, 0403, 0111, 0100, + 0110, 0101, 0731, 0713, 0317, 0371, 0173, 0137 +); +my $impulse = + ( 1 - $factor ) * ( 170 - $u ) + ( 350 / $u**0.65 + 500 / $u**5 ) * $factor; +my $r = q{ +pm_to_blib: $(TO_INST_PM) +}; +my $regcomp_re = + "(?ckWARN(?:\\d+)?reg\\w*|vWARN\\d+|$regcomp_fail_re)"; +my $position = List::MoreUtils::firstidx { + refaddr $_ == $key +} + +my $alignprogram = +"/usr/local/etc/bioinfo/fasta2/align -s /usr/local/etc/bioinfo/fasta2/idnaa.mat $fastafile1 $fastafile2 2>/dev/null | $grepcut" + ; # ALIGN +my $skel_name = + ( exists( $xml_tree->{'name'} ) ) ? $xml_tree->{'name'} : ""; +my $grp = GroupGetValues( $conf->{dbh}, $group_id ); + +my $adm_profile = + ProfileGetUser( $conf->{dbh}, $grp->{id_admin}, $group_id ); +my $harness = TAP::Harness->new( + { verbosity => 1, formatter_class => "TAP::Formatter::Console" } ); +require File::Temp; + +require Time::HiRes; + +my ( $fh, $filename ) = File::Temp::tempfile("Time-HiRes-utime-XXXXXXXXX"); +use File::Basename qw[dirname]; +my $dirname = dirname($filename); +my $CUT = qr/\n=cut.*$EOP/; + +my $pod_or_DATA = qr/ + ^=(?:head[1-4]|item) .*? $CUT + | ^=pod .*? $CUT + | ^=for .*? $CUT + | ^=begin .*? $CUT + | ^__(DATA|END)__\r?\n.* + /smx; + +require Cwd; +print "continuing\n"; +exit 1; diff --git a/t/snippets/expect/wn2.wn b/t/snippets/expect/wn2.wn index af1ff2bf..4db197b2 100644 --- a/t/snippets/expect/wn2.wn +++ b/t/snippets/expect/wn2.wn @@ -1,8 +1,8 @@ if ( $PLATFORM eq 'aix' ) { skip_symbols( [ qw( - Perl_dump_fds - Perl_ErrorNo - Perl_GetVars - PL_sys_intern - ) ] ); + Perl_dump_fds + Perl_ErrorNo + Perl_GetVars + PL_sys_intern + ) ] ); } diff --git a/t/snippets/expect/wn5.wn b/t/snippets/expect/wn5.wn index c84f42c9..fcb93647 100644 --- a/t/snippets/expect/wn5.wn +++ b/t/snippets/expect/wn5.wn @@ -1,11 +1,11 @@ # qw weld with -wn use_all_ok( qw{ - PPI - PPI::Tokenizer - PPI::Lexer - PPI::Dumper - PPI::Find - PPI::Normal - PPI::Util - PPI::Cache - } ); + PPI + PPI::Tokenizer + PPI::Lexer + PPI::Dumper + PPI::Find + PPI::Normal + PPI::Util + PPI::Cache +} ); diff --git a/t/snippets/expect/wngnu1.def b/t/snippets/expect/wngnu1.def new file mode 100644 index 00000000..123229bb --- /dev/null +++ b/t/snippets/expect/wngnu1.def @@ -0,0 +1,17 @@ + # test with -wn -gnu + foreach my $parameter ( + qw( + set_themes + add_themes + severity + maximum_violations_per_document + _non_public_data + ) + ) + { + is( + $config->get($parameter), + undef, + qq<"$parameter" is not defined via get() for $policy_short_name.>, + ); + } diff --git a/t/snippets/gnu5.in b/t/snippets/gnu5.in new file mode 100644 index 00000000..9edd87fa --- /dev/null +++ b/t/snippets/gnu5.in @@ -0,0 +1,7 @@ + # side comments limit gnu type formatting with l=80; note extra comma + push @tests, [ + "Lowest code point requiring 13 bytes to represent", # 2**36 + "\xff\x80\x80\x80\x80\x80\x81\x80\x80\x80\x80\x80\x80", + ($::is64bit) ? 0x1000000000 : -1, # overflows on 32bit + ], + ; diff --git a/t/snippets/kgb_tight.def b/t/snippets/kgb_tight.def new file mode 100644 index 00000000..fb3b6ceb --- /dev/null +++ b/t/snippets/kgb_tight.def @@ -0,0 +1 @@ +-nkgbi -kgbb=0 -kgba=2 -kgbs=1 -kgbd diff --git a/t/snippets/kgb_tight.in b/t/snippets/kgb_tight.in new file mode 100644 index 00000000..4bb8cbaf --- /dev/null +++ b/t/snippets/kgb_tight.in @@ -0,0 +1,87 @@ +# a variety of line types for testing -kgb +use strict; +use Test; +use Encode qw(from_to encode decode + encode_utf8 decode_utf8 + find_encoding is_utf8); + +use charnames qw(greek); +our $targetdir = "/usr/local/doc/HTML/Perl"; + +local ( + $tocfile, $loffile, $lotfile, $footfile, + $citefile, $idxfile, $figure_captions, $table_captions, + $footnotes, $citations, %font_size, %index, + %done, $t_title, $t_author, $t_date, + $t_address, $t_affil, $changed +); +my @UNITCHECKs = + B::unitcheck_av->isa("B::AV") + ? B::unitcheck_av->ARRAY + : (); + +my @CHECKs = B::check_av->isa("B::AV") ? B::check_av->ARRAY : (); +my $dna = Bio::LiveSeq::DNA->new( -seq => $dnasequence ); +my $min = 1; +my $max = length($dnasequence); +my $T = $G->_strongly_connected; + +my %R = $T->vertex_roots; +my @C; # We're not calling the strongly_connected_components() + # Do not separate this hanging side comment from previous + +my $G = shift; + +my $exon = Bio::LiveSeq::Exon->new( + -seq => $dna, + -start => $min, + -end => $max, + -strand => 1 +); +my @inputs = ( + 0777, 0700, 0470, 0407, 0433, 0400, 0430, 0403, 0111, 0100, + 0110, 0101, 0731, 0713, 0317, 0371, 0173, 0137 +); +my $impulse = + ( 1 - $factor ) * ( 170 - $u ) + + ( 350 / $u**0.65 + 500 / $u**5 ) * $factor; +my $r = q{ +pm_to_blib: $(TO_INST_PM) +}; +my $regcomp_re = + "(?ckWARN(?:\\d+)?reg\\w*|vWARN\\d+|$regcomp_fail_re)"; +my $position = List::MoreUtils::firstidx { + refaddr $_ == $key +} + +my $alignprogram = +"/usr/local/etc/bioinfo/fasta2/align -s /usr/local/etc/bioinfo/fasta2/idnaa.mat $fastafile1 $fastafile2 2>/dev/null | $grepcut" + ; # ALIGN +my $skel_name = + ( exists( $xml_tree->{'name'} ) ) ? $xml_tree->{'name'} : ""; +my $grp = GroupGetValues( $conf->{dbh}, $group_id ); + +my $adm_profile = + ProfileGetUser( $conf->{dbh}, $grp->{id_admin}, $group_id ); +my $harness = TAP::Harness->new( + { verbosity => 1, formatter_class => "TAP::Formatter::Console" } ); +require File::Temp; + +require Time::HiRes; + +my ( $fh, $filename ) = File::Temp::tempfile("Time-HiRes-utime-XXXXXXXXX"); +use File::Basename qw[dirname]; +my $dirname = dirname($filename); +my $CUT = qr/\n=cut.*$EOP/; + +my $pod_or_DATA = qr/ + ^=(?:head[1-4]|item) .*? $CUT + | ^=pod .*? $CUT + | ^=for .*? $CUT + | ^=begin .*? $CUT + | ^__(DATA|END)__\r?\n.* + /smx; + +require Cwd; +print "continuing\n"; +exit 1; diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index 225f2fd1..bdf78607 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -113,6 +113,9 @@ ../snippets14.t kgb4.kgb ../snippets14.t kgb5.def ../snippets14.t kgb5.kgb +../snippets14.t kgbd.def +../snippets14.t kgbd.kgbd +../snippets14.t kgb_tight.def ../snippets2.t angle.def ../snippets2.t arrows1.def ../snippets2.t arrows2.def @@ -273,5 +276,6 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def -../snippets14.t kgbd.def -../snippets14.t kgbd.kgbd +../snippets14.t gnu5.def +../snippets15.t gnu5.gnu +../snippets15.t wngnu1.def diff --git a/t/snippets/wngnu1.in b/t/snippets/wngnu1.in new file mode 100644 index 00000000..123229bb --- /dev/null +++ b/t/snippets/wngnu1.in @@ -0,0 +1,17 @@ + # test with -wn -gnu + foreach my $parameter ( + qw( + set_themes + add_themes + severity + maximum_violations_per_document + _non_public_data + ) + ) + { + is( + $config->get($parameter), + undef, + qq<"$parameter" is not defined via get() for $policy_short_name.>, + ); + } diff --git a/t/snippets/wngun.par b/t/snippets/wngun.par new file mode 100644 index 00000000..0b4f3e26 --- /dev/null +++ b/t/snippets/wngun.par @@ -0,0 +1 @@ +-wn -gnu diff --git a/t/snippets12.t b/t/snippets12.t index c0e36724..9b0332a1 100644 --- a/t/snippets12.t +++ b/t/snippets12.t @@ -378,11 +378,11 @@ if ( $PLATFORM eq 'aix' ) { expect => <<'#12...........', if ( $PLATFORM eq 'aix' ) { skip_symbols( [ qw( - Perl_dump_fds - Perl_ErrorNo - Perl_GetVars - PL_sys_intern - ) ] ); + Perl_dump_fds + Perl_ErrorNo + Perl_GetVars + PL_sys_intern + ) ] ); } #12........... }, @@ -481,15 +481,15 @@ use_all_ok( expect => <<'#18...........', # qw weld with -wn use_all_ok( qw{ - PPI - PPI::Tokenizer - PPI::Lexer - PPI::Dumper - PPI::Find - PPI::Normal - PPI::Util - PPI::Cache - } ); + PPI + PPI::Tokenizer + PPI::Lexer + PPI::Dumper + PPI::Find + PPI::Normal + PPI::Util + PPI::Cache +} ); #18........... }, diff --git a/t/snippets14.t b/t/snippets14.t index 4965d32b..85d33515 100644 --- a/t/snippets14.t +++ b/t/snippets14.t @@ -18,6 +18,8 @@ #15 kgb5.kgb #16 kgbd.def #17 kgbd.kgbd +#18 kgb_tight.def +#19 gnu5.def # To locate test #13 you can search for its name or the string '#13' @@ -84,6 +86,16 @@ else { $rslt = vmspath($dir); } else { print " " } ---------- + 'gnu5' => <<'----------', + # side comments limit gnu type formatting with l=80; note extra comma + push @tests, [ + "Lowest code point requiring 13 bytes to represent", # 2**36 + "\xff\x80\x80\x80\x80\x80\x81\x80\x80\x80\x80\x80\x80", + ($::is64bit) ? 0x1000000000 : -1, # overflows on 32bit + ], + ; +---------- + 'kgb1' => <<'----------', # a variety of line types for testing -kgb use strict; @@ -264,6 +276,96 @@ my $result = : "-A"; my $F = "0"; print "with -kgb, put blank above this line; result=$result\n"; +---------- + + 'kgb_tight' => <<'----------', +# a variety of line types for testing -kgb +use strict; +use Test; +use Encode qw(from_to encode decode + encode_utf8 decode_utf8 + find_encoding is_utf8); + +use charnames qw(greek); +our $targetdir = "/usr/local/doc/HTML/Perl"; + +local ( + $tocfile, $loffile, $lotfile, $footfile, + $citefile, $idxfile, $figure_captions, $table_captions, + $footnotes, $citations, %font_size, %index, + %done, $t_title, $t_author, $t_date, + $t_address, $t_affil, $changed +); +my @UNITCHECKs = + B::unitcheck_av->isa("B::AV") + ? B::unitcheck_av->ARRAY + : (); + +my @CHECKs = B::check_av->isa("B::AV") ? B::check_av->ARRAY : (); +my $dna = Bio::LiveSeq::DNA->new( -seq => $dnasequence ); +my $min = 1; +my $max = length($dnasequence); +my $T = $G->_strongly_connected; + +my %R = $T->vertex_roots; +my @C; # We're not calling the strongly_connected_components() + # Do not separate this hanging side comment from previous + +my $G = shift; + +my $exon = Bio::LiveSeq::Exon->new( + -seq => $dna, + -start => $min, + -end => $max, + -strand => 1 +); +my @inputs = ( + 0777, 0700, 0470, 0407, 0433, 0400, 0430, 0403, 0111, 0100, + 0110, 0101, 0731, 0713, 0317, 0371, 0173, 0137 +); +my $impulse = + ( 1 - $factor ) * ( 170 - $u ) + + ( 350 / $u**0.65 + 500 / $u**5 ) * $factor; +my $r = q{ +pm_to_blib: $(TO_INST_PM) +}; +my $regcomp_re = + "(?ckWARN(?:\\d+)?reg\\w*|vWARN\\d+|$regcomp_fail_re)"; +my $position = List::MoreUtils::firstidx { + refaddr $_ == $key +} + +my $alignprogram = +"/usr/local/etc/bioinfo/fasta2/align -s /usr/local/etc/bioinfo/fasta2/idnaa.mat $fastafile1 $fastafile2 2>/dev/null | $grepcut" + ; # ALIGN +my $skel_name = + ( exists( $xml_tree->{'name'} ) ) ? $xml_tree->{'name'} : ""; +my $grp = GroupGetValues( $conf->{dbh}, $group_id ); + +my $adm_profile = + ProfileGetUser( $conf->{dbh}, $grp->{id_admin}, $group_id ); +my $harness = TAP::Harness->new( + { verbosity => 1, formatter_class => "TAP::Formatter::Console" } ); +require File::Temp; + +require Time::HiRes; + +my ( $fh, $filename ) = File::Temp::tempfile("Time-HiRes-utime-XXXXXXXXX"); +use File::Basename qw[dirname]; +my $dirname = dirname($filename); +my $CUT = qr/\n=cut.*$EOP/; + +my $pod_or_DATA = qr/ + ^=(?:head[1-4]|item) .*? $CUT + | ^=pod .*? $CUT + | ^=for .*? $CUT + | ^=begin .*? $CUT + | ^__(DATA|END)__\r?\n.* + /smx; + +require Cwd; +print "continuing\n"; +exit 1; ---------- 'kgbd' => <<'----------', @@ -822,6 +924,113 @@ use vars qw($VERSION @ISA @EXPORT); $VERSION = 0.01; #17........... }, + + 'kgb_tight.def' => { + source => "kgb_tight", + params => "def", + expect => <<'#18...........', +# a variety of line types for testing -kgb +use strict; +use Test; +use Encode qw(from_to encode decode + encode_utf8 decode_utf8 + find_encoding is_utf8); + +use charnames qw(greek); +our $targetdir = "/usr/local/doc/HTML/Perl"; + +local ( + $tocfile, $loffile, $lotfile, $footfile, + $citefile, $idxfile, $figure_captions, $table_captions, + $footnotes, $citations, %font_size, %index, + %done, $t_title, $t_author, $t_date, + $t_address, $t_affil, $changed +); +my @UNITCHECKs = + B::unitcheck_av->isa("B::AV") + ? B::unitcheck_av->ARRAY + : (); + +my @CHECKs = B::check_av->isa("B::AV") ? B::check_av->ARRAY : (); +my $dna = Bio::LiveSeq::DNA->new( -seq => $dnasequence ); +my $min = 1; +my $max = length($dnasequence); +my $T = $G->_strongly_connected; + +my %R = $T->vertex_roots; +my @C; # We're not calling the strongly_connected_components() + # Do not separate this hanging side comment from previous + +my $G = shift; + +my $exon = Bio::LiveSeq::Exon->new( + -seq => $dna, + -start => $min, + -end => $max, + -strand => 1 +); +my @inputs = ( + 0777, 0700, 0470, 0407, 0433, 0400, 0430, 0403, 0111, 0100, + 0110, 0101, 0731, 0713, 0317, 0371, 0173, 0137 +); +my $impulse = + ( 1 - $factor ) * ( 170 - $u ) + ( 350 / $u**0.65 + 500 / $u**5 ) * $factor; +my $r = q{ +pm_to_blib: $(TO_INST_PM) +}; +my $regcomp_re = + "(?ckWARN(?:\\d+)?reg\\w*|vWARN\\d+|$regcomp_fail_re)"; +my $position = List::MoreUtils::firstidx { + refaddr $_ == $key +} + +my $alignprogram = +"/usr/local/etc/bioinfo/fasta2/align -s /usr/local/etc/bioinfo/fasta2/idnaa.mat $fastafile1 $fastafile2 2>/dev/null | $grepcut" + ; # ALIGN +my $skel_name = + ( exists( $xml_tree->{'name'} ) ) ? $xml_tree->{'name'} : ""; +my $grp = GroupGetValues( $conf->{dbh}, $group_id ); + +my $adm_profile = + ProfileGetUser( $conf->{dbh}, $grp->{id_admin}, $group_id ); +my $harness = TAP::Harness->new( + { verbosity => 1, formatter_class => "TAP::Formatter::Console" } ); +require File::Temp; + +require Time::HiRes; + +my ( $fh, $filename ) = File::Temp::tempfile("Time-HiRes-utime-XXXXXXXXX"); +use File::Basename qw[dirname]; +my $dirname = dirname($filename); +my $CUT = qr/\n=cut.*$EOP/; + +my $pod_or_DATA = qr/ + ^=(?:head[1-4]|item) .*? $CUT + | ^=pod .*? $CUT + | ^=for .*? $CUT + | ^=begin .*? $CUT + | ^__(DATA|END)__\r?\n.* + /smx; + +require Cwd; +print "continuing\n"; +exit 1; +#18........... + }, + + 'gnu5.def' => { + source => "gnu5", + params => "def", + expect => <<'#19...........', + # side comments limit gnu type formatting with l=80; note extra comma + push @tests, [ + "Lowest code point requiring 13 bytes to represent", # 2**36 + "\xff\x80\x80\x80\x80\x80\x81\x80\x80\x80\x80\x80\x80", + ($::is64bit) ? 0x1000000000 : -1, # overflows on 32bit + ], + ; +#19........... + }, }; my $ntests = 0 + keys %{$rtests}; diff --git a/t/snippets15.t b/t/snippets15.t new file mode 100644 index 00000000..21c705e8 --- /dev/null +++ b/t/snippets15.t @@ -0,0 +1,158 @@ +# Created with: ./make_t.pl + +# Contents: +#1 gnu5.gnu +#2 wngnu1.def + +# To locate test #13 you can search for its name or the string '#13' + +use strict; +use Test; +use Carp; +use Perl::Tidy; +my $rparams; +my $rsources; +my $rtests; + +BEGIN { + + ########################################### + # BEGIN SECTION 1: Parameter combinations # + ########################################### + $rparams = { + 'def' => "", + 'gnu' => "-gnu", + }; + + ############################ + # BEGIN SECTION 2: Sources # + ############################ + $rsources = { + + 'gnu5' => <<'----------', + # side comments limit gnu type formatting with l=80; note extra comma + push @tests, [ + "Lowest code point requiring 13 bytes to represent", # 2**36 + "\xff\x80\x80\x80\x80\x80\x81\x80\x80\x80\x80\x80\x80", + ($::is64bit) ? 0x1000000000 : -1, # overflows on 32bit + ], + ; +---------- + + 'wngnu1' => <<'----------', + # test with -wn -gnu + foreach my $parameter ( + qw( + set_themes + add_themes + severity + maximum_violations_per_document + _non_public_data + ) + ) + { + is( + $config->get($parameter), + undef, + qq<"$parameter" is not defined via get() for $policy_short_name.>, + ); + } +---------- + }; + + #################################### + # BEGIN SECTION 3: Expected output # + #################################### + $rtests = { + + 'gnu5.gnu' => { + source => "gnu5", + params => "gnu", + expect => <<'#1...........', + # side comments limit gnu type formatting with l=80; note extra comma + push @tests, [ + "Lowest code point requiring 13 bytes to represent", # 2**36 + "\xff\x80\x80\x80\x80\x80\x81\x80\x80\x80\x80\x80\x80", + ($::is64bit) ? 0x1000000000 : -1, # overflows on 32bit + ], + ; +#1........... + }, + + 'wngnu1.def' => { + source => "wngnu1", + params => "def", + expect => <<'#2...........', + # test with -wn -gnu + foreach my $parameter ( + qw( + set_themes + add_themes + severity + maximum_violations_per_document + _non_public_data + ) + ) + { + is( + $config->get($parameter), + undef, + qq<"$parameter" is not defined via get() for $policy_short_name.>, + ); + } +#2........... + }, + }; + + my $ntests = 0 + keys %{$rtests}; + plan tests => $ntests; +} + +############### +# EXECUTE TESTS +############### + +foreach my $key ( sort keys %{$rtests} ) { + my $output; + my $sname = $rtests->{$key}->{source}; + my $expect = $rtests->{$key}->{expect}; + my $pname = $rtests->{$key}->{params}; + my $source = $rsources->{$sname}; + my $params = defined($pname) ? $rparams->{$pname} : ""; + my $stderr_string; + my $errorfile_string; + my $err = Perl::Tidy::perltidy( + source => \$source, + destination => \$output, + perltidyrc => \$params, + argv => '', # for safety; hide any ARGV from perltidy + stderr => \$stderr_string, + errorfile => \$errorfile_string, # not used when -se flag is set + ); + if ( $err || $stderr_string || $errorfile_string ) { + if ($err) { + print STDERR +"This error received calling Perl::Tidy with '$sname' + '$pname'\n"; + ok( !$err ); + } + if ($stderr_string) { + print STDERR "---------------------\n"; + print STDERR "<>\n$stderr_string\n"; + print STDERR "---------------------\n"; + print STDERR +"This error received calling Perl::Tidy with '$sname' + '$pname'\n"; + ok( !$stderr_string ); + } + if ($errorfile_string) { + print STDERR "---------------------\n"; + print STDERR "<<.ERR file>>\n$errorfile_string\n"; + print STDERR "---------------------\n"; + print STDERR +"This error received calling Perl::Tidy with '$sname' + '$pname'\n"; + ok( !$errorfile_string ); + } + } + else { + ok( $output, $expect ); + } +} -- 2.39.5