From: Steve Hancock Date: Tue, 20 Oct 2020 15:23:44 +0000 (-0700) Subject: add test case for parsing signatures X-Git-Tag: 20201001.03~53 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ba3223f451417b351fcd9abfcd72c7ea5a59914a;p=perltidy.git add test case for parsing signatures --- diff --git a/t/snippets/expect/mangle4.def b/t/snippets/expect/mangle4.def new file mode 100644 index 00000000..ed062760 --- /dev/null +++ b/t/snippets/expect/mangle4.def @@ -0,0 +1,17 @@ +# a useful parsing test from 'signatures.t' +use feature "signatures"; +no warnings "experimental::signatures"; + +sub t086 ( #foo))) + $ #foo))) + a #foo))) + , #foo))) + , #foo))) + $ #foo))) + b #foo))) + = #foo))) + 333 #foo))) + , #foo))) + , #foo))) + ) #foo))) +{ $a . $b } diff --git a/t/snippets/expect/mangle4.mangle b/t/snippets/expect/mangle4.mangle new file mode 100644 index 00000000..80e5a405 --- /dev/null +++ b/t/snippets/expect/mangle4.mangle @@ -0,0 +1,16 @@ +# a useful parsing test from 'signatures.t' +use feature "signatures"; +no warnings "experimental::signatures"; +sub t086(#foo))) +$ #foo))) + a#foo))) +,#foo))) +,#foo))) +$ #foo))) + b#foo))) + =#foo))) + 333#foo))) +,#foo))) +,#foo))) + )#foo))) +{$a.$b} diff --git a/t/snippets/mangle4.in b/t/snippets/mangle4.in new file mode 100644 index 00000000..e8d388ab --- /dev/null +++ b/t/snippets/mangle4.in @@ -0,0 +1,17 @@ +# a useful parsing test from 'signatures.t' +use feature "signatures"; +no warnings "experimental::signatures"; +sub t086 + ( #foo))) + $ #foo))) + a #foo))) + , #foo))) + , #foo))) + $ #foo))) + b #foo))) + = #foo))) + 333 #foo))) + , #foo))) + , #foo))) + ) #foo))) + { $a.$b } diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index cdb09985..f124af0d 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -420,3 +420,5 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def +../snippets22.t mangle4.def +../snippets22.t mangle4.mangle diff --git a/t/snippets22.t b/t/snippets22.t index c36c9806..082fcad0 100644 --- a/t/snippets22.t +++ b/t/snippets22.t @@ -11,6 +11,8 @@ #8 xci.def #9 xci.xci1 #10 xci.xci2 +#11 mangle4.def +#12 mangle4.mangle # To locate test #13 you can search for its name or the string '#13' @@ -37,6 +39,7 @@ BEGIN { ---------- 'def' => "", 'here_long' => "-l=33", + 'mangle' => "--mangle", 'xci1' => "-xci", 'xci2' => "-pbp -nst -nse -xci", }; @@ -114,6 +117,26 @@ $sth= $dbh->prepare (<<"END_OF_SELECT") or die "Couldn't prepare SQL" ; FROM logins WHERE username='$user' END_OF_SELECT +---------- + + 'mangle4' => <<'----------', +# a useful parsing test from 'signatures.t' +use feature "signatures"; +no warnings "experimental::signatures"; +sub t086 + ( #foo))) + $ #foo))) + a #foo))) + , #foo))) + , #foo))) + $ #foo))) + b #foo))) + = #foo))) + 333 #foo))) + , #foo))) + , #foo))) + ) #foo))) + { $a.$b } ---------- 'xci' => <<'----------', @@ -390,6 +413,53 @@ my $otherHashRef : undef; #10........... }, + + 'mangle4.def' => { + source => "mangle4", + params => "def", + expect => <<'#11...........', +# a useful parsing test from 'signatures.t' +use feature "signatures"; +no warnings "experimental::signatures"; + +sub t086 ( #foo))) + $ #foo))) + a #foo))) + , #foo))) + , #foo))) + $ #foo))) + b #foo))) + = #foo))) + 333 #foo))) + , #foo))) + , #foo))) + ) #foo))) +{ $a . $b } +#11........... + }, + + 'mangle4.mangle' => { + source => "mangle4", + params => "mangle", + expect => <<'#12...........', +# a useful parsing test from 'signatures.t' +use feature "signatures"; +no warnings "experimental::signatures"; +sub t086(#foo))) +$ #foo))) + a#foo))) +,#foo))) +,#foo))) +$ #foo))) + b#foo))) + =#foo))) + 333#foo))) +,#foo))) +,#foo))) + )#foo))) +{$a.$b} +#12........... + }, }; my $ntests = 0 + keys %{$rtests};