]> git.donarmstrong.com Git - perltidy.git/commitdiff
added more signature and prototype test cases
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 29 Oct 2020 13:46:17 +0000 (06:46 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 29 Oct 2020 13:46:17 +0000 (06:46 -0700)
t/snippets/expect/signature.def
t/snippets/packing_list.txt
t/snippets/signature.in
t/snippets17.t

index 5f11ab9d3e0cb6b000aa168adee20578c8dd4c57..b33d07e26355264b33586d103583c9dbd58f0102 100644 (file)
@@ -17,3 +17,21 @@ sub t022 ( $p = do { $z += 10; 222 }, $a = do { $z++; 333 } ) { "$p/$a" }
 my $subref = sub ( $cat, $id = do { state $auto_id = 0; $auto_id++ } ) {
     ...;
 };
+
+# signature and prototype and attribute
+sub foo1 ( $x, $y ) : prototype ( $$ ) : shared { }
+
+sub foo11 ( $thing, % ) { print $thing }
+
+sub animal4 ( $cat, $ = ) { }    # second argument is optional
+
+*share = sub ( \[$@%] ) { };
+
+# extruded test
+sub foo2 ( $first, $, $third ) {
+    return "first=$first, third=$third";
+}
+
+# valid attributes
+sub fnord (&\%) : switch(10,foo(7,3)) : expensive;
+sub plugh () : Ugly('\(") : Bad;
index 02a3413123a47d222e047c09b135a9aefdfa1161..f6643b7597298d0c3001ce0910f5d0b840e04da3 100644 (file)
 ../snippets22.t        xci.xci2
 ../snippets22.t        mangle4.def
 ../snippets22.t        mangle4.mangle
+../snippets22.t        extrude5.def
+../snippets22.t        extrude5.extrude
 ../snippets3.t ce_wn1.ce_wn
 ../snippets3.t ce_wn1.def
 ../snippets3.t colin.colin
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
-../snippets22.t        extrude5.def
-../snippets22.t        extrude5.extrude
index def25b5003afee752a10894d15337d03e25ed558..2c2615987435f3d3133cf01291877c3dbcf8ac0c 100644 (file)
@@ -19,3 +19,34 @@ sub t022 (
 my $subref = sub ( $cat, $id = do { state $auto_id = 0; $auto_id++ } ) {
     ...;
 };
+
+# signature and prototype and attribute
+sub foo1 ( $x, $y ) : prototype ( $$ ) : shared { }
+
+sub foo11 ( $thing, % ) { print $thing }
+
+sub animal4 ( $cat, $ = ) {   } # second argument is optional
+
+*share = sub 
+( \[$@%] ) { };
+
+# extruded test
+sub foo2
+  (
+  $
+  first
+  ,
+  $
+  ,
+  $
+  third
+  )
+  {
+  return
+  "first=$first, third=$third"
+  ;
+  }
+
+# valid attributes
+sub fnord (&\%) : switch(10,foo(7,3)) : expensive;
+sub plugh () : Ugly('\(") : Bad;
index f2fa32ce32a9004dad3beeda7c85e4d496a4dbf7..49c0874bfab026661827b26be66f4323118d1c9e 100644 (file)
@@ -247,6 +247,37 @@ sub t022 (
 my $subref = sub ( $cat, $id = do { state $auto_id = 0; $auto_id++ } ) {
     ...;
 };
+
+# signature and prototype and attribute
+sub foo1 ( $x, $y ) : prototype ( $$ ) : shared { }
+
+sub foo11 ( $thing, % ) { print $thing }
+
+sub animal4 ( $cat, $ = ) {   } # second argument is optional
+
+*share = sub 
+( \[$@%] ) { };
+
+# extruded test
+sub foo2
+  (
+  $
+  first
+  ,
+  $
+  ,
+  $
+  third
+  )
+  {
+  return
+  "first=$first, third=$third"
+  ;
+  }
+
+# valid attributes
+sub fnord (&\%) : switch(10,foo(7,3)) : expensive;
+sub plugh () : Ugly('\(") : Bad;
 ----------
 
         'ternary4' => <<'----------',
@@ -957,6 +988,24 @@ sub t022 ( $p = do { $z += 10; 222 }, $a = do { $z++; 333 } ) { "$p/$a" }
 my $subref = sub ( $cat, $id = do { state $auto_id = 0; $auto_id++ } ) {
     ...;
 };
+
+# signature and prototype and attribute
+sub foo1 ( $x, $y ) : prototype ( $$ ) : shared { }
+
+sub foo11 ( $thing, % ) { print $thing }
+
+sub animal4 ( $cat, $ = ) { }    # second argument is optional
+
+*share = sub ( \[$@%] ) { };
+
+# extruded test
+sub foo2 ( $first, $, $third ) {
+    return "first=$first, third=$third";
+}
+
+# valid attributes
+sub fnord (&\%) : switch(10,foo(7,3)) : expensive;
+sub plugh () : Ugly('\(") : Bad;
 #17...........
         },