From ebf3b86d7576e7858db3f4aa030c955ab0f9a3b4 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 11 Jul 2021 06:47:29 -0700 Subject: [PATCH] add test for format-skipping issue discussed in git #67 --- t/snippets/comments.in | 3 +++ t/snippets/expect/comments.comments1 | 3 +++ t/snippets/expect/comments.comments2 | 3 +++ t/snippets/expect/comments.comments3 | 4 ++++ t/snippets/expect/comments.comments4 | 3 +++ t/snippets/expect/comments.comments5 | 3 +++ t/snippets/expect/comments.def | 3 +++ t/snippets17.t | 19 +++++++++++++++++++ t/snippets18.t | 6 ++++++ 9 files changed, 47 insertions(+) diff --git a/t/snippets/comments.in b/t/snippets/comments.in index a8e39452..261c4db8 100644 --- a/t/snippets/comments.in +++ b/t/snippets/comments.in @@ -1,5 +1,8 @@ #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length($_[0]) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment diff --git a/t/snippets/expect/comments.comments1 b/t/snippets/expect/comments.comments1 index fbe3ff02..aedc7d89 100644 --- a/t/snippets/expect/comments.comments1 +++ b/t/snippets/expect/comments.comments1 @@ -1,5 +1,8 @@ #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length( $_[0] ) } # side comment # hanging side comment diff --git a/t/snippets/expect/comments.comments2 b/t/snippets/expect/comments.comments2 index 5eb3693a..cddf93a8 100644 --- a/t/snippets/expect/comments.comments2 +++ b/t/snippets/expect/comments.comments2 @@ -1,4 +1,7 @@ #!/usr/bin/perl -w +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length( $_[0] ) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment diff --git a/t/snippets/expect/comments.comments3 b/t/snippets/expect/comments.comments3 index eecb8204..732a5d49 100644 --- a/t/snippets/expect/comments.comments3 +++ b/t/snippets/expect/comments.comments3 @@ -1,5 +1,9 @@ #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; + +#>>> sub length { return length( $_[0] ) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment diff --git a/t/snippets/expect/comments.comments4 b/t/snippets/expect/comments.comments4 index dee97983..f6139ec1 100644 --- a/t/snippets/expect/comments.comments4 +++ b/t/snippets/expect/comments.comments4 @@ -1,5 +1,8 @@ #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length( $_[0] ) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment diff --git a/t/snippets/expect/comments.comments5 b/t/snippets/expect/comments.comments5 index 2b428bd2..df9774d9 100644 --- a/t/snippets/expect/comments.comments5 +++ b/t/snippets/expect/comments.comments5 @@ -1,5 +1,8 @@ #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length( $_[0] ) } # a blank will be inserted to prevent forming a hanging side comment diff --git a/t/snippets/expect/comments.def b/t/snippets/expect/comments.def index 431e492c..4f2440e0 100644 --- a/t/snippets/expect/comments.def +++ b/t/snippets/expect/comments.def @@ -1,5 +1,8 @@ #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length( $_[0] ) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment diff --git a/t/snippets17.t b/t/snippets17.t index 858a99f1..e726bd4d 100644 --- a/t/snippets17.t +++ b/t/snippets17.t @@ -90,6 +90,9 @@ ok IsWindow($c_sub_khwnd), 'IsWindow works on the client'; 'comments' => <<'----------', #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length($_[0]) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment @@ -341,6 +344,9 @@ ok IsWindow($c_sub_khwnd), 'IsWindow works on the client'; expect => <<'#4...........', #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length( $_[0] ) } # side comment # hanging side comment @@ -431,6 +437,9 @@ Some pod after __END__ to delete with -dp and trim with -trp params => "comments2", expect => <<'#5...........', #!/usr/bin/perl -w +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length( $_[0] ) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment @@ -497,6 +506,10 @@ __END__ expect => <<'#6...........', #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; + +#>>> sub length { return length( $_[0] ) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment @@ -590,6 +603,9 @@ Some pod after __END__ to delete with -dp and trim with -trp expect => <<'#7...........', #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length( $_[0] ) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment @@ -692,6 +708,9 @@ Some pod after __END__ to delete with -dp and trim with -trp expect => <<'#8...........', #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length( $_[0] ) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment diff --git a/t/snippets18.t b/t/snippets18.t index 8a33351a..67ca2647 100644 --- a/t/snippets18.t +++ b/t/snippets18.t @@ -119,6 +119,9 @@ catch { 'comments' => <<'----------', #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length($_[0]) } # side comment # hanging side comment # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment @@ -365,6 +368,9 @@ my ( $a, $b, $c ) = @_; # test -nsak="my for" expect => <<'#4...........', #!/usr/bin/perl -w # an initial hash bang line cannot be deleted with -dp +#<<< format skipping of first code can cause an error message in perltidy v20210625 +my $rvar = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]; +#>>> sub length { return length( $_[0] ) } # a blank will be inserted to prevent forming a hanging side comment -- 2.39.5