From: Steve Hancock Date: Thu, 15 Nov 2018 01:06:46 +0000 (-0800) Subject: Added some test cases X-Git-Tag: 20181117~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1fd86f051883d5db2d274f7eab8f6fb97bee19fe;p=perltidy.git Added some test cases --- diff --git a/t/snippets/align14.in b/t/snippets/align14.in index 198968ac..e7a01925 100644 --- a/t/snippets/align14.in +++ b/t/snippets/align14.in @@ -1,4 +1,4 @@ # align the = -my ($apple) = new Fruit( "Apple1", .1, .30 ); -my ($grapefruit) = new Grapefruit( "Grapefruit1", .3 ); -my ($redgrapefruit) = new RedGrapefruit( "Grapefruit2", .3 ); +my($apple)=new Fruit("Apple1",.1,.30); +my($grapefruit)=new Grapefruit("Grapefruit1",.3); +my($redgrapefruit)=new RedGrapefruit("Grapefruit2",.3); diff --git a/t/snippets/align15.in b/t/snippets/align15.in index 05c17bb9..244d9f5d 100644 --- a/t/snippets/align15.in +++ b/t/snippets/align15.in @@ -3,4 +3,3 @@ my$color=$opts{'-color'}//'black'; my$background=$opts{'-background'}//'none'; my$linewidth=$opts{'-linewidth'}//1; my$radius=$opts{'-radius'}//0; - diff --git a/t/snippets/align16.in b/t/snippets/align16.in new file mode 100644 index 00000000..964bad2c --- /dev/null +++ b/t/snippets/align16.in @@ -0,0 +1,10 @@ +# align all at first => +use constant { + PHFAM => [ { John => 1, Jane => 2, Sally => 3 }, 33, 28, 3 ], + FAMILY => [qw( John Jane Sally )], + AGES => { John => 33, Jane => 28, Sally => 3 }, + RFAM => [ [qw( John Jane Sally )] ], + THREE => 3, + SPIT => sub { shift }, +}; + diff --git a/t/snippets/align17.t b/t/snippets/align17.t new file mode 100644 index 00000000..dd363996 --- /dev/null +++ b/t/snippets/align17.t @@ -0,0 +1,9 @@ +# align => even at broken sub block +my%opt=( +'cc'=>sub{$param::cachecom=1;}, +'cd'=>sub{$param::cachedisable=1;}, +'p'=>sub{ +$param::pflag=1; +$param::build=0; +} +); diff --git a/t/snippets/align18.t b/t/snippets/align18.t new file mode 100644 index 00000000..144e99db --- /dev/null +++ b/t/snippets/align18.t @@ -0,0 +1,11 @@ +#align '&&' +for($ENV{HTTP_USER_AGENT}){ +$page= +/Mac/&&'m/Macintrash.html' +||/Win(dows)?NT/&&'e/evilandrude.html' +||/Win|MSIE|WebTV/&&'m/MicroslothWindows.html' +||/Linux/&&'l/Linux.html' +||/HP-UX/&&'h/HP-SUX.html' +||/SunOS/&&'s/ScumOS.html' +||'a/AppendixB.html'; +} diff --git a/t/snippets/break5.in b/t/snippets/break5.in new file mode 100644 index 00000000..a3f83bd9 --- /dev/null +++ b/t/snippets/break5.in @@ -0,0 +1,10 @@ +# do not break at .'s after the ? +return ( + ( $pod eq $pod2 ) & amp; + & + ( $htype eq "NAME" ) + ) + ? "\n<A NAME=\"" + . $value + . "\">\n$text</A>\n" + : "\n$type$pod2.html\#" . $value . "\">$text<\/A>\n"; diff --git a/t/snippets/expect/align15.def b/t/snippets/expect/align15.def index 16089f41..9ad1d033 100644 --- a/t/snippets/expect/align15.def +++ b/t/snippets/expect/align15.def @@ -3,4 +3,3 @@ my $color = $opts{'-color'} // 'black'; my $background = $opts{'-background'} // 'none'; my $linewidth = $opts{'-linewidth'} // 1; my $radius = $opts{'-radius'} // 0; - diff --git a/t/snippets/expect/align16.def b/t/snippets/expect/align16.def new file mode 100644 index 00000000..cfdf836b --- /dev/null +++ b/t/snippets/expect/align16.def @@ -0,0 +1,10 @@ +# align all at first => +use constant { + PHFAM => [ { John => 1, Jane => 2, Sally => 3 }, 33, 28, 3 ], + FAMILY => [qw( John Jane Sally )], + AGES => { John => 33, Jane => 28, Sally => 3 }, + RFAM => [ [qw( John Jane Sally )] ], + THREE => 3, + SPIT => sub { shift }, +}; + diff --git a/t/snippets/expect/break5.def b/t/snippets/expect/break5.def new file mode 100644 index 00000000..facf6ed0 --- /dev/null +++ b/t/snippets/expect/break5.def @@ -0,0 +1,8 @@ +# do not break at .'s after the ? +return ( + ( $pod eq $pod2 ) & amp; + & + ( $htype eq "NAME" ) + ) + ? "\n<A NAME=\"" . $value . "\">\n$text</A>\n" + : "\n$type$pod2.html\#" . $value . "\">$text<\/A>\n"; diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index c2f26eb2..b6b7195e 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -85,6 +85,8 @@ ../snippets13.t align13.def ../snippets13.t rt127633.def ../snippets13.t rt127633.rt127633 +../snippets13.t align14.def +../snippets13.t align15.def ../snippets2.t angle.def ../snippets2.t arrows1.def ../snippets2.t arrows2.def @@ -245,5 +247,5 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def -../snippets13.t align14.def -../snippets13.t align15.def +../snippets13.t align16.def +../snippets13.t break5.def