]> git.donarmstrong.com Git - perltidy.git/commitdiff
Added some test cases
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 15 Nov 2018 01:06:46 +0000 (17:06 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 15 Nov 2018 01:06:46 +0000 (17:06 -0800)
t/snippets/align14.in
t/snippets/align15.in
t/snippets/align16.in [new file with mode: 0644]
t/snippets/align17.t [new file with mode: 0644]
t/snippets/align18.t [new file with mode: 0644]
t/snippets/break5.in [new file with mode: 0644]
t/snippets/expect/align15.def
t/snippets/expect/align16.def [new file with mode: 0644]
t/snippets/expect/break5.def [new file with mode: 0644]
t/snippets/packing_list.txt

index 198968ac33b72e06cd4862f6b189fcdcfb685cf7..e7a01925e4dbfc95bc35059dccbef0abae81bc81 100644 (file)
@@ -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);
index 05c17bb9284fd9334e050ea9f335a0dd6a445fa7..244d9f5da51b5d3bcd01e5a5b314dcc848e94f53 100644 (file)
@@ -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 (file)
index 0000000..964bad2
--- /dev/null
@@ -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 (file)
index 0000000..dd36399
--- /dev/null
@@ -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 (file)
index 0000000..144e99d
--- /dev/null
@@ -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 (file)
index 0000000..a3f83bd
--- /dev/null
@@ -0,0 +1,10 @@
+# do not break at .'s after the ?
+return (
+    ( $pod eq $pod2 ) & amp;
+      &amp;
+      ( $htype eq "NAME" )
+  )
+  ? "\n&lt;A NAME=\""
+  . $value
+  . "\"&gt;\n$text&lt;/A&gt;\n"
+  : "\n$type$pod2.html\#" . $value . "\"&gt;$text&lt;\/A&gt;\n";
index 16089f41ce005e42209bf31aa051e5e3700e4889..9ad1d03343259b9968a05641e14c76d964256d49 100644 (file)
@@ -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 (file)
index 0000000..cfdf836
--- /dev/null
@@ -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 (file)
index 0000000..facf6ed
--- /dev/null
@@ -0,0 +1,8 @@
+# do not break at .'s after the ?
+return (
+    ( $pod eq $pod2 ) & amp;
+    &amp;
+    ( $htype eq "NAME" )
+  )
+  ? "\n&lt;A NAME=\"" . $value . "\"&gt;\n$text&lt;/A&gt;\n"
+  : "\n$type$pod2.html\#" . $value . "\"&gt;$text&lt;\/A&gt;\n";
index c2f26eb23f47fe21a7b6ac056e937d3ca48eee4e..b6b7195e99b206cf512d5578f7f5d89c98eeeae9 100644 (file)
@@ -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
 ../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