]> git.donarmstrong.com Git - perltidy.git/commitdiff
add test case for -lp
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 22 Sep 2021 22:51:45 +0000 (15:51 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 22 Sep 2021 22:51:45 +0000 (15:51 -0700)
dev-bin/perltidy_random_setup.pl
t/snippets/expect/lp2.def [new file with mode: 0644]
t/snippets/expect/lp2.lp [new file with mode: 0644]
t/snippets/lp2.in [new file with mode: 0644]
t/snippets/packing_list.txt
t/snippets25.t

index 5f9ccdce6db26dd775ba7552fffe6152579fd0b8..440831d618899e2d13f15c04c853696b693481c5 100755 (executable)
@@ -28,6 +28,12 @@ my $rprofiles     = [];
 # if file 'perltidy.pl' is found here then make that the default
 if ( -e './perltidy.pl' ) { $perltidy = './perltidy.pl' }
 
+# always require a separate version of perltidy
+# TODO: go get a copy if there is none
+else { die "Please move a copy of perltidy.pl here first\n" }
+
+# TODO: see if DEVEL_MODE is set, turn it on if not
+
 query(<<EOM);
 
 IMPORTANT: You should start this program in an empty directory that you create
@@ -205,7 +211,7 @@ sub filter_files {
     @{$rlist} = grep { $_ !~ /\.png$/ } @{$rlist};
     @{$rlist} = grep { $_ !~ /\.jpg$/i } @{$rlist};
     @{$rlist} = grep { $_ !~ /\.jpeg$/i } @{$rlist};
-    @{$rlist} = grep { $_ ne 'DIAGNOSTICS' } @{$rlist};
+    @{$rlist} = grep { $_ !~ /\bDIAGNOSTICS$/ } @{$rlist};
 
     # exclude pro{$rlist}
     @{$rlist} = grep { $_ !~ /profile\.[0-9]*/ } @{$rlist};
diff --git a/t/snippets/expect/lp2.def b/t/snippets/expect/lp2.def
new file mode 100644 (file)
index 0000000..aa7d304
--- /dev/null
@@ -0,0 +1,8 @@
+# test issue git #74, lost -lp when final anon sub brace followed by '}'
+Util::Parser->new(
+    Handlers => {
+        Init  => sub { $self->init(@_) },
+        Mid   => { sub { shift; $self->mid(@_) } },
+        Final => sub { shift; $self->final(@_) }
+    }
+)->parse( $_[0] );
diff --git a/t/snippets/expect/lp2.lp b/t/snippets/expect/lp2.lp
new file mode 100644 (file)
index 0000000..6028f78
--- /dev/null
@@ -0,0 +1,8 @@
+# test issue git #74, lost -lp when final anon sub brace followed by '}'
+Util::Parser->new(
+                   Handlers => {
+                                 Init  => sub { $self->init(@_) },
+                                 Mid   => { sub { shift; $self->mid(@_) } },
+                                 Final => sub { shift; $self->final(@_) }
+                   }
+)->parse( $_[0] );
diff --git a/t/snippets/lp2.in b/t/snippets/lp2.in
new file mode 100644 (file)
index 0000000..220a7d6
--- /dev/null
@@ -0,0 +1,8 @@
+# test issue git #74, lost -lp when final anon sub brace followed by '}'
+Util::Parser->new(
+    Handlers => {
+        Init  => sub { $self->init(@_) },
+        Mid =>  { sub { shift; $self->mid(@_) } },
+        Final => sub { shift; $self->final(@_) }
+    }
+)->parse( $_[0] );
index 889b10e8fa608b29f6008e0b3d9e77b8876ab6d4..7fc7617cc458ddfe6d33b83edf0d8f38bcaf4239 100644 (file)
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
+../snippets25.t        lp2.def
+../snippets25.t        lp2.lp
index 3bf1cb7d1c44be9cf9002b3b21207636a02b508b..7b4b33b732751045c7ae2d8143f3c8189027bf06 100644 (file)
@@ -5,6 +5,8 @@
 #2 novalign.novalign1
 #3 novalign.novalign2
 #4 novalign.novalign3
+#5 lp2.def
+#6 lp2.lp
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -23,6 +25,7 @@ BEGIN {
     ###########################################
     $rparams = {
         'def'       => "",
+        'lp'        => "-lp",
         'novalign1' => "-novalign",
         'novalign2' => "-nvsc -nvbc -msc=2",
         'novalign3' => "-nvc",
@@ -33,6 +36,17 @@ BEGIN {
     ############################
     $rsources = {
 
+        'lp2' => <<'----------',
+# test issue git #74, lost -lp when final anon sub brace followed by '}'
+Util::Parser->new(
+    Handlers => {
+        Init  => sub { $self->init(@_) },
+        Mid =>  { sub { shift; $self->mid(@_) } },
+        Final => sub { shift; $self->final(@_) }
+    }
+)->parse( $_[0] );
+----------
+
         'novalign' => <<'----------',
 {
 # simple vertical alignment of '=' and '#'
@@ -134,6 +148,36 @@ my $fail = 0;    # failed
 
 #4...........
         },
+
+        'lp2.def' => {
+            source => "lp2",
+            params => "def",
+            expect => <<'#5...........',
+# test issue git #74, lost -lp when final anon sub brace followed by '}'
+Util::Parser->new(
+    Handlers => {
+        Init  => sub { $self->init(@_) },
+        Mid   => { sub { shift; $self->mid(@_) } },
+        Final => sub { shift; $self->final(@_) }
+    }
+)->parse( $_[0] );
+#5...........
+        },
+
+        'lp2.lp' => {
+            source => "lp2",
+            params => "lp",
+            expect => <<'#6...........',
+# test issue git #74, lost -lp when final anon sub brace followed by '}'
+Util::Parser->new(
+                   Handlers => {
+                                 Init  => sub { $self->init(@_) },
+                                 Mid   => { sub { shift; $self->mid(@_) } },
+                                 Final => sub { shift; $self->final(@_) }
+                   }
+)->parse( $_[0] );
+#6...........
+        },
     };
 
     my $ntests = 0 + keys %{$rtests};