]> git.donarmstrong.com Git - perltidy.git/commitdiff
added numerous tests to improve coverage
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 22 Apr 2020 02:13:19 +0000 (19:13 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 22 Apr 2020 02:13:19 +0000 (19:13 -0700)
67 files changed:
t/snippets/braces.in [new file with mode: 0644]
t/snippets/braces1.par [new file with mode: 0644]
t/snippets/braces2.par [new file with mode: 0644]
t/snippets/braces3.par [new file with mode: 0644]
t/snippets/comments.in
t/snippets/comments1.par
t/snippets/comments3.par
t/snippets/comments4.par
t/snippets/comments5.par
t/snippets/coverage_missing.txt
t/snippets/coverage_values.txt
t/snippets/csc.in [new file with mode: 0644]
t/snippets/csc1.par [new file with mode: 0644]
t/snippets/csc2.par [new file with mode: 0644]
t/snippets/expect/braces.braces1 [new file with mode: 0644]
t/snippets/expect/braces.braces2 [new file with mode: 0644]
t/snippets/expect/braces.braces3 [new file with mode: 0644]
t/snippets/expect/braces.def [new file with mode: 0644]
t/snippets/expect/comments.comments1
t/snippets/expect/comments.comments2
t/snippets/expect/comments.comments3
t/snippets/expect/comments.comments4
t/snippets/expect/comments.comments5
t/snippets/expect/comments.def
t/snippets/expect/csc.csc1 [new file with mode: 0644]
t/snippets/expect/csc.csc2 [new file with mode: 0644]
t/snippets/expect/csc.def [new file with mode: 0644]
t/snippets/expect/iob.def [new file with mode: 0644]
t/snippets/expect/iob.iob [new file with mode: 0644]
t/snippets/expect/kis.def [new file with mode: 0644]
t/snippets/expect/kis.kis [new file with mode: 0644]
t/snippets/expect/maths.def [new file with mode: 0644]
t/snippets/expect/maths.maths1 [new file with mode: 0644]
t/snippets/expect/maths.maths2 [new file with mode: 0644]
t/snippets/expect/misc_tests.def [new file with mode: 0644]
t/snippets/expect/misc_tests.misc_tests [new file with mode: 0644]
t/snippets/expect/outdent.def [new file with mode: 0644]
t/snippets/expect/outdent.outdent1 [new file with mode: 0644]
t/snippets/expect/sbq.def [new file with mode: 0644]
t/snippets/expect/sbq.sbq0 [new file with mode: 0644]
t/snippets/expect/sbq.sbq2 [new file with mode: 0644]
t/snippets/expect/tightness.def [new file with mode: 0644]
t/snippets/expect/tightness.tightness1 [new file with mode: 0644]
t/snippets/expect/tightness.tightness2 [new file with mode: 0644]
t/snippets/expect/tightness.tightness3 [new file with mode: 0644]
t/snippets/iob.in [new file with mode: 0644]
t/snippets/iob.par [new file with mode: 0644]
t/snippets/kis.in [new file with mode: 0644]
t/snippets/kis.par [new file with mode: 0644]
t/snippets/maths.in [new file with mode: 0644]
t/snippets/maths1.par [new file with mode: 0644]
t/snippets/maths2.par [new file with mode: 0644]
t/snippets/misc_tests.in [new file with mode: 0644]
t/snippets/misc_tests.par [new file with mode: 0644]
t/snippets/outdent.in [new file with mode: 0644]
t/snippets/outdent1.par [new file with mode: 0644]
t/snippets/packing_list.txt
t/snippets/sbq.in [new file with mode: 0644]
t/snippets/sbq0.par [new file with mode: 0644]
t/snippets/sbq2.par [new file with mode: 0644]
t/snippets/tightness.in [new file with mode: 0644]
t/snippets/tightness1.par [new file with mode: 0644]
t/snippets/tightness2.par [new file with mode: 0644]
t/snippets/tightness3.par [new file with mode: 0644]
t/snippets17.t
t/snippets18.t
t/snippets19.t [new file with mode: 0644]

diff --git a/t/snippets/braces.in b/t/snippets/braces.in
new file mode 100644 (file)
index 0000000..8b93c94
--- /dev/null
@@ -0,0 +1,12 @@
+sub message {
+    if ( !defined( $_[0] ) ) {
+        print("Hello, World\n");
+    }
+    else {
+        print( $_[0], "\n" );
+    }
+}
+
+$myfun = sub {
+    print("Hello, World\n");
+};
diff --git a/t/snippets/braces1.par b/t/snippets/braces1.par
new file mode 100644 (file)
index 0000000..e777cf5
--- /dev/null
@@ -0,0 +1 @@
+-bl -asbl
diff --git a/t/snippets/braces2.par b/t/snippets/braces2.par
new file mode 100644 (file)
index 0000000..ba66778
--- /dev/null
@@ -0,0 +1 @@
+-sbl
diff --git a/t/snippets/braces3.par b/t/snippets/braces3.par
new file mode 100644 (file)
index 0000000..3ee06bc
--- /dev/null
@@ -0,0 +1 @@
+-bli
index 9fa0ee3595a6bc1b9907a213eb20fcd9d6f05f7c..9328f6f3b9a09d507dcde623fabbb5f9b6d1d05a 100644 (file)
@@ -9,16 +9,35 @@ sub macro_get_names { #
 # 
 # %name = macro_get_names();  (key=macrohandle, value=macroname)
 #
-##local(%name);  # a static block comment
-   local(%name)=();
+##local(%name);  # a static block comment without indentation
+   local(%name)=();  ## a static side comment to test -ssc
+
+ # a spaced block comment to test -isbc
    for (0..$                                          #mac_ver) {
+      # a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
       $name{$_} = $mac_ext[$idx{$mac_exti[$_]}];
+      $vmsfile =~ s/;[\d\-]*$//; # very long side comment; Clip off version number; we can use a newer version as well
+
    }
    %name;
 } 
 
 
 
+    @month_of_year = ( 
+        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+    ##  'Dec', 'Nov'   [a static block comment with indentation]
+        'Nov', 'Dec');
+
+
+{    # this side comment will not align
+    my $IGNORE = 0;    # This is a side comment
+                       # This is a hanging side comment
+                       # And so is this
+
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
 
 # side comments at different indentation levels should not normally be aligned
 { { { { { ${msg} = "Hello World!"; print "My message: ${msg}\n"; } } #end level 4
@@ -27,6 +46,15 @@ sub macro_get_names { #
 } # end level 1
 
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
+
 
 # some blank lines follow
 
index cd3c986197bf2ada0b17b099072660157cf6c353..ceb3c03864e837609ddeb27f516177dea4cd6f29 100644 (file)
@@ -1 +1 @@
--fpsc=40 -iscl -nibc
+-fpsc=40 -iscl -nibc -nhsc -ssc
index 20cd628410299996743cf857f12f86a531ac4887..4b5f9142c3447dbf4430e1a0efbf0e1306c17fd6 100644 (file)
@@ -1 +1 @@
--mbl=2
+-mbl=2 -isbc
index e006eaf362182c3eefa7e74557c60e7f35482a03..ce467f5c7af27bcb5afc4931db50ed9600c853f8 100644 (file)
@@ -1 +1 @@
--kbl=2
+-kbl=2 -nolc -osbc
index 52663e54616bcddf67517ae13235a076b3c882a0..1fa4c457e14b50d36b8b8489df01e9704a619bf5 100644 (file)
@@ -1 +1 @@
--dsc
+-dsc -nsbc
index 35407170b81a5889ef27258d76205cc5f621f86a..a53b83fb28449fa923da8b18977d2003e4eb1822 100644 (file)
@@ -1,22 +1,20 @@
 # No coverage in test snippets for these parameters
 DEBUG
+assert-tidy
+assert-untidy
 backlink
 block-brace-vertical-tightness-list
-brace-left-and-indent
 brace-left-and-indent-list
-break-after-all-operators
 break-at-old-attribute-breakpoints
 break-at-old-keyword-breakpoints
 break-at-old-logical-breakpoints
 break-at-old-ternary-breakpoints
-break-before-all-operators
 cachedir
 closing-side-comment-list
 closing-side-comment-prefix
 closing-side-comment-warnings
 closing-side-comments-balanced
 closing-token-indentation
-cuddled-block-list
 cuddled-block-list-exclusive
 dump-cuddled-block-list
 dump-defaults
@@ -29,7 +27,6 @@ dump-want-left-space
 dump-want-right-space
 extended-syntax
 file-size-order
-fixed-position-side-comment
 force-read-binary
 format-skipping
 format-skipping-begin
@@ -100,10 +97,8 @@ html-src-extension
 html-table-of-contents
 html-toc-extension
 htmlroot
-ignore-old-breakpoints
-indent-block-comments
 indent-closing-brace
-keep-interior-semicolons
+keyword-group-blanks-list
 libpods
 logfile
 logfile-gap
@@ -114,14 +109,9 @@ memoize
 no-profile
 nohtml-style-sheets
 noprofile
-nospace-after-keyword
 notidy
 npro
-opening-anonymous-sub-brace-on-new-line
 outdent-keyword-list
-outdent-keywords
-outdent-labels
-outdent-static-block-comments
 outfile
 output-file-extension
 output-line-ending
@@ -143,14 +133,11 @@ show-options
 space-after-keyword
 space-function-paren
 space-keyword-paren
-space-terminal-semicolon
 stack-closing-block-brace
 stack-opening-block-brace
 standard-output
 static-block-comment-prefix
-static-block-comments
 static-side-comment-prefix
-static-side-comments
 stylesheet
 tabs
 tee-block-comments
@@ -159,6 +146,7 @@ tee-side-comments
 title
 trim-pod
 trim-qw
+use-unicode-gcstring
 valign
 version
 vertical-tightness
index d2fe2fd3147f261d57381be41884b5ef5d28fb3c..b44d86eec53cba6151362584b5a615c71bbfdc41 100644 (file)
 $VAR1 = {
-          'outdent-long-quotes' => [
-                                     0,
-                                     1
-                                   ],
-          'opening-square-bracket-right' => [
-                                              0,
-                                              1
-                                            ],
-          'cuddled-else' => [
-                              0,
-                              1
-                            ],
-          'iterations' => [
-                            1
-                          ],
-          'indent-columns' => [
-                                0,
-                                2,
-                                4
-                              ],
-          'add-semicolons' => [
-                                0,
-                                1
-                              ],
-          'keep-old-blank-lines' => [
-                                      0,
+          'space-terminal-semicolon' => [
+                                          0,
+                                          1
+                                        ],
+          'format' => [
+                        'html',
+                        'tidy'
+                      ],
+          'want-break-before' => [
+                                   ' ',
+                                   '% + - * / x != == >= <= =~ !~ < > | & = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=',
+                                   '% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=',
+                                   '='
+                                 ],
+          'cuddled-break-option' => [
                                       1
                                     ],
-          'stack-opening-paren' => [
-                                     0,
-                                     1
-                                   ],
-          'stack-opening-hash-brace' => [
+          'keep-interior-semicolons' => [
                                           0,
                                           1
                                         ],
-          'backup-file-extension' => [
-                                       'bak',
-                                       '~'
-                                     ],
-          'timestamp' => [
-                           0,
-                           1
-                         ],
-          'opening-brace-on-new-line' => [
+          'paren-vertical-tightness' => [
+                                          0,
+                                          1,
+                                          2
+                                        ],
+          'closing-paren-indentation' => [
                                            0,
-                                           1
+                                           1,
+                                           2
                                          ],
-          'continuation-indentation' => [
+          'want-right-space' => [
+                                  '= .= =~ !~ ? :'
+                                ],
+          'stack-closing-hash-brace' => [
                                           0,
-                                          2,
-                                          4
+                                          1
                                         ],
           'closing-brace-indentation' => [
                                            0,
                                            1,
                                            2
                                          ],
-          'closing-side-comment-else-flag' => [
+          'block-brace-vertical-tightness' => [
                                                 0
                                               ],
-          'variable-maximum-line-length' => [
-                                              0,
-                                              1
-                                            ],
-          'blanks-before-comments' => [
-                                        0,
-                                        1
-                                      ],
-          'closing-side-comment-maximum-text' => [
-                                                   20,
-                                                   40
-                                                 ],
-          'fuzzy-line-length' => [
-                                   0,
-                                   1
-                                 ],
-          'blank-lines-after-opening-block-list' => [
-                                                      '*'
-                                                    ],
-          'paren-vertical-tightness-closing' => [
+          'brace-vertical-tightness-closing' => [
                                                   0,
                                                   2
                                                 ],
-          'closing-side-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'starting-indentation-level' => [
-                                            0
-                                          ],
-          'paren-vertical-tightness' => [
-                                          0,
-                                          1,
-                                          2
-                                        ],
-          'recombine' => [
-                           0,
-                           1
-                         ],
-          'maximum-fields-per-table' => [
-                                          0
-                                        ],
-          'opening-paren-right' => [
+          'stack-opening-paren' => [
                                      0,
                                      1
                                    ],
+          'add-whitespace' => [
+                                0,
+                                1
+                              ],
           'delete-semicolons' => [
                                    0,
                                    1
                                  ],
-          'closing-paren-indentation' => [
-                                           0,
-                                           1,
-                                           2
-                                         ],
-          'hanging-side-comments' => [
+          'break-at-old-semicolon-breakpoints' => [
+                                                    0,
+                                                    1
+                                                  ],
+          'continuation-indentation' => [
+                                          0,
+                                          2,
+                                          4
+                                        ],
+          'brace-left-and-indent' => [
                                        0,
                                        1
                                      ],
-          'comma-arrow-breakpoints' => [
-                                         1,
-                                         5
-                                       ],
-          'opening-sub-brace-on-new-line' => [
-                                               0,
-                                               1
-                                             ],
-          'square-bracket-tightness' => [
-                                          1,
-                                          2
-                                        ],
-          'warning-output' => [
-                                0,
-                                1
-                              ],
-          'square-bracket-vertical-tightness-closing' => [
-                                                           0,
-                                                           2
-                                                         ],
-          'blanks-before-blocks' => [
-                                      0,
-                                      1
-                                    ],
+          'square-bracket-vertical-tightness' => [
+                                                   0,
+                                                   1,
+                                                   2
+                                                 ],
+          'closing-side-comment-else-flag' => [
+                                                0
+                                              ],
+          'short-concatenation-item-length' => [
+                                                 12,
+                                                 8
+                                               ],
+          'break-before-all-operators' => [
+                                            0,
+                                            1
+                                          ],
           'delete-block-comments' => [
                                        0,
                                        1
                                      ],
-          'add-newlines' => [
-                              0,
-                              1
-                            ],
-          'want-right-space' => [
-                                  '= .= =~ !~ ? :'
-                                ],
-          'stack-closing-square-bracket' => [
-                                              0,
-                                              1
-                                            ],
-          'want-break-before' => [
-                                   ' ',
-                                   '% + - * / x != == >= <= =~ !~ < > | & = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=',
-                                   '% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x='
-                                 ],
-          'entab-leading-whitespace' => [
-                                          8
-                                        ],
-          'space-backslash-quote' => [
+          'starting-indentation-level' => [
+                                            0
+                                          ],
+          'closing-side-comments' => [
+                                       0,
                                        1
                                      ],
-          'add-whitespace' => [
-                                0,
-                                1
-                              ],
-          'space-for-semicolon' => [
+          'opening-paren-right' => [
                                      0,
                                      1
                                    ],
-          'maximum-consecutive-blank-lines' => [
-                                                 0,
-                                                 1,
-                                                 2
-                                               ],
-          'standard-error-output' => [
+          'blanks-before-comments' => [
+                                        0,
+                                        1
+                                      ],
+          'minimum-space-to-comment' => [
+                                          10,
+                                          2,
+                                          4
+                                        ],
+          'square-bracket-vertical-tightness-closing' => [
+                                                           0,
+                                                           2
+                                                         ],
+          'indent-block-comments' => [
                                        0,
                                        1
                                      ],
-          'closing-side-comment-interval' => [
-                                               20,
-                                               6
-                                             ],
-          'brace-tightness' => [
-                                 0,
-                                 1,
-                                 2
-                               ],
-          'nowant-right-space' => [
-                                    '++ --',
-                                    '..'
-                                  ],
-          'opening-brace-always-on-right' => [
-                                               0,
-                                               1
-                                             ],
-          'blank-lines-after-opening-block' => [
-                                                 2
+          'break-at-old-method-breakpoints' => [
+                                                 0,
+                                                 1
                                                ],
-          'delete-closing-side-comments' => [
-                                              0,
-                                              1
-                                            ],
-          'delete-old-whitespace' => [
-                                       0,
-                                       1
-                                     ],
-          'cuddled-break-option' => [
-                                      1
+          'keep-old-blank-lines' => [
+                                      0,
+                                      1,
+                                      2
                                     ],
-          'blank-lines-before-closing-block' => [
-                                                  1
-                                                ],
-          'block-brace-tightness' => [
+          'space-prototype-paren' => [
                                        0,
                                        1,
                                        2
                                      ],
-          'outdent-long-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'stack-closing-hash-brace' => [
+          'stack-opening-hash-brace' => [
                                           0,
                                           1
                                         ],
-          'check-syntax' => [
-                              0,
-                              1
-                            ],
-          'line-up-parentheses' => [
-                                     0,
-                                     1
-                                   ],
-          'ignore-side-comment-lengths' => [
+          'keyword-group-blanks-inside' => [
                                              0,
                                              1
                                            ],
-          'default-tabsize' => [
-                                 8
-                               ],
-          'delete-old-newlines' => [
-                                     0,
-                                     1
-                                   ],
-          'character-encoding' => [
-                                    'none'
-                                  ],
-          'tight-secret-operators' => [
+          'long-block-line-count' => [
+                                       8
+                                     ],
+          'blank-lines-before-subs' => [
+                                         0,
+                                         1
+                                       ],
+          'closing-side-comment-maximum-text' => [
+                                                   20,
+                                                   40
+                                                 ],
+          'one-line-block-nesting' => [
                                         0,
                                         1
                                       ],
+          'outdent-labels' => [
+                                0,
+                                1
+                              ],
+          'opening-hash-brace-right' => [
+                                          0,
+                                          1
+                                        ],
+          'brace-vertical-tightness' => [
+                                          0,
+                                          1,
+                                          2
+                                        ],
+          'break-at-old-comma-breakpoints' => [
+                                                0,
+                                                1
+                                              ],
+          'blank-lines-after-opening-block' => [
+                                                 2
+                                               ],
+          'timestamp' => [
+                           0,
+                           1
+                         ],
+          'stack-opening-square-bracket' => [
+                                              0,
+                                              1
+                                            ],
+          'blank-lines-before-closing-block' => [
+                                                  1
+                                                ],
+          'cuddled-else' => [
+                              0,
+                              1
+                            ],
+          'outdent-long-quotes' => [
+                                     0,
+                                     1
+                                   ],
+          'paren-vertical-tightness-closing' => [
+                                                  0,
+                                                  2
+                                                ],
+          'iterations' => [
+                            1
+                          ],
           'delete-pod' => [
                             0,
                             1
                           ],
-          'maximum-line-length' => [
+          'standard-error-output' => [
+                                       0,
+                                       1
+                                     ],
+          'space-for-semicolon' => [
                                      0,
-                                     1,
-                                     100,
-                                     100000,
-                                     160,
-                                     77,
-                                     78,
-                                     80
+                                     1
                                    ],
+          'warning-output' => [
+                                0,
+                                1
+                              ],
+          'one-line-block-semicolons' => [
+                                           0,
+                                           1,
+                                           2
+                                         ],
+          'sub-alias-list' => [
+                                'method fun'
+                              ],
+          'square-bracket-tightness' => [
+                                          0,
+                                          1,
+                                          2
+                                        ],
+          'variable-maximum-line-length' => [
+                                              0,
+                                              1
+                                            ],
+          'block-brace-tightness' => [
+                                       0,
+                                       1,
+                                       2
+                                     ],
+          'keyword-group-blanks-repeat-count' => [
+                                                   0
+                                                 ],
+          'opening-brace-always-on-right' => [
+                                               0,
+                                               1
+                                             ],
           'delete-side-comments' => [
                                       0,
                                       1
                                     ],
-          'opening-hash-brace-right' => [
-                                          0,
-                                          1
-                                        ],
+          'paren-tightness' => [
+                                 0,
+                                 1,
+                                 2
+                               ],
+          'static-side-comments' => [
+                                      0,
+                                      1
+                                    ],
           'blank-lines-before-packages' => [
                                              0,
                                              1
                                            ],
-          'short-concatenation-item-length' => [
-                                                 12,
-                                                 8
-                                               ],
-          'want-break-after' => [
-                                  '% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x= . << >> -> && ||'
-                                ],
-          'brace-vertical-tightness-closing' => [
-                                                  0,
-                                                  2
-                                                ],
-          'format' => [
-                        'html',
-                        'tidy'
-                      ],
-          'want-left-space' => [
-                                 '= .= =~ !~ :'
-                               ],
-          'indent-spaced-block-comments' => [
+          'indent-columns' => [
+                                0,
+                                2,
+                                4
+                              ],
+          'fuzzy-line-length' => [
+                                   0,
+                                   1
+                                 ],
+          'blank-lines-after-opening-block-list' => [
+                                                      '*'
+                                                    ],
+          'entab-leading-whitespace' => [
+                                          8
+                                        ],
+          'add-newlines' => [
+                              0,
+                              1
+                            ],
+          'hanging-side-comments' => [
+                                       0,
+                                       1
+                                     ],
+          'stack-closing-square-bracket' => [
                                               0,
                                               1
                                             ],
-          'closing-square-bracket-indentation' => [
-                                                    0,
-                                                    1,
-                                                    2
-                                                  ],
-          'block-brace-vertical-tightness' => [
-                                                0
-                                              ],
-          'square-bracket-vertical-tightness' => [
-                                                   0,
-                                                   1,
-                                                   2
-                                                 ],
-          'brace-vertical-tightness' => [
-                                          0,
-                                          1,
-                                          2
+          'fixed-position-side-comment' => [
+                                             40
+                                           ],
+          'nospace-after-keyword' => [
+                                       'my for'
+                                     ],
+          'add-semicolons' => [
+                                0,
+                                1
+                              ],
+          'delete-closing-side-comments' => [
+                                              0,
+                                              1
+                                            ],
+          'want-left-space' => [
+                                 '= .= =~ !~ :'
+                               ],
+          'delete-old-newlines' => [
+                                     0,
+                                     1
+                                   ],
+          'weld-nested-containers' => [
+                                        0,
+                                        1
+                                      ],
+          'maximum-fields-per-table' => [
+                                          0
                                         ],
-          'break-at-old-comma-breakpoints' => [
-                                                0,
-                                                1
-                                              ],
-          'nowant-left-space' => [
-                                   '++ -- ?',
-                                   '..'
-                                 ],
-          'blank-lines-before-closing-block-list' => [
-                                                       '*'
-                                                     ],
+          'default-tabsize' => [
+                                 8
+                               ],
           'backup-and-modify-in-place' => [
                                             0,
                                             1
                                           ],
-          'blank-lines-before-subs' => [
-                                         0,
-                                         1
-                                       ],
-          'stack-opening-square-bracket' => [
+          'closing-square-bracket-indentation' => [
+                                                    0,
+                                                    1,
+                                                    2
+                                                  ],
+          'character-encoding' => [
+                                    'guess'
+                                  ],
+          'static-block-comments' => [
+                                       0,
+                                       1
+                                     ],
+          'maximum-consecutive-blank-lines' => [
+                                                 0,
+                                                 1,
+                                                 2
+                                               ],
+          'break-after-all-operators' => [
+                                           0,
+                                           1
+                                         ],
+          'space-backslash-quote' => [
+                                       0,
+                                       1,
+                                       2
+                                     ],
+          'indent-spaced-block-comments' => [
                                               0,
                                               1
                                             ],
-          'perl-syntax-check-flags' => [
-                                         '-c -T'
+          'backup-file-extension' => [
+                                       'bak',
+                                       '~'
+                                     ],
+          'keyword-group-blanks-delete' => [
+                                             0,
+                                             1
+                                           ],
+          'opening-square-bracket-right' => [
+                                              0,
+                                              1
+                                            ],
+          'want-break-after' => [
+                                  '% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x= . << >> -> && ||'
+                                ],
+          'recombine' => [
+                           0,
+                           1
+                         ],
+          'comma-arrow-breakpoints' => [
+                                         1,
+                                         5
                                        ],
-          'paren-tightness' => [
+          'keyword-group-blanks-size' => [
+                                           '5'
+                                         ],
+          'brace-tightness' => [
+                                 0,
                                  1,
                                  2
                                ],
-          'minimum-space-to-comment' => [
-                                          2,
-                                          4
-                                        ],
-          'weld-nested-containers' => [
+          'outdent-keywords' => [
+                                  0,
+                                  1
+                                ],
+          'nowant-left-space' => [
+                                   '++ -- ?',
+                                   '..',
+                                   '= + - / *'
+                                 ],
+          'opening-anonymous-sub-brace-on-new-line' => [
+                                                         0,
+                                                         1
+                                                       ],
+          'stack-closing-paren' => [
+                                     0,
+                                     1
+                                   ],
+          'tight-secret-operators' => [
                                         0,
                                         1
                                       ],
-          'long-block-line-count' => [
-                                       8
+          'ignore-side-comment-lengths' => [
+                                             0,
+                                             1
+                                           ],
+          'perl-syntax-check-flags' => [
+                                         '-c -T'
+                                       ],
+          'opening-brace-on-new-line' => [
+                                           0,
+                                           1
+                                         ],
+          'blanks-before-blocks' => [
+                                      0,
+                                      1
+                                    ],
+          'keyword-group-blanks-before' => [
+                                             1,
+                                             2
+                                           ],
+          'blank-lines-before-closing-block-list' => [
+                                                       '*'
+                                                     ],
+          'delete-old-whitespace' => [
+                                       0,
+                                       1
                                      ],
-          'stack-closing-paren' => [
+          'cuddled-block-list' => [
+                                    'map,sort,grep',
+                                    'sort,map,grep'
+                                  ],
+          'closing-side-comment-interval' => [
+                                               2,
+                                               20,
+                                               6
+                                             ],
+          'maximum-line-length' => [
+                                     0,
+                                     1,
+                                     100,
+                                     100000,
+                                     160,
+                                     77,
+                                     78,
+                                     80
+                                   ],
+          'ignore-old-breakpoints' => [
+                                        0,
+                                        1
+                                      ],
+          'check-syntax' => [
+                              0,
+                              1
+                            ],
+          'outdent-static-block-comments' => [
+                                               0,
+                                               1
+                                             ],
+          'keyword-group-blanks-after' => [
+                                            1,
+                                            2
+                                          ],
+          'line-up-parentheses' => [
                                      0,
                                      1
-                                   ]
+                                   ],
+          'outdent-long-comments' => [
+                                       0,
+                                       1
+                                     ],
+          'nowant-right-space' => [
+                                    '++ --',
+                                    '..',
+                                    '= + - / *',
+                                    'A'
+                                  ],
+          'opening-sub-brace-on-new-line' => [
+                                               0,
+                                               1
+                                             ]
         };
diff --git a/t/snippets/csc.in b/t/snippets/csc.in
new file mode 100644 (file)
index 0000000..87ba7a8
--- /dev/null
@@ -0,0 +1,8 @@
+        sub message {
+            if ( !defined( $_[0] ) ) {
+                print("Hello, World\n");
+            }
+            else {
+                print( $_[0], "\n" );
+            }
+        } ## end sub message
diff --git a/t/snippets/csc1.par b/t/snippets/csc1.par
new file mode 100644 (file)
index 0000000..f0f1921
--- /dev/null
@@ -0,0 +1 @@
+-csc -csci=2 -cscb
diff --git a/t/snippets/csc2.par b/t/snippets/csc2.par
new file mode 100644 (file)
index 0000000..fef4520
--- /dev/null
@@ -0,0 +1 @@
+-dcsc
diff --git a/t/snippets/expect/braces.braces1 b/t/snippets/expect/braces.braces1
new file mode 100644 (file)
index 0000000..364230b
--- /dev/null
@@ -0,0 +1,16 @@
+sub message
+{
+    if ( !defined( $_[0] ) )
+    {
+        print("Hello, World\n");
+    }
+    else
+    {
+        print( $_[0], "\n" );
+    }
+}
+
+$myfun = sub
+{
+    print("Hello, World\n");
+};
diff --git a/t/snippets/expect/braces.braces2 b/t/snippets/expect/braces.braces2
new file mode 100644 (file)
index 0000000..c55b4c1
--- /dev/null
@@ -0,0 +1,13 @@
+sub message
+{
+    if ( !defined( $_[0] ) ) {
+        print("Hello, World\n");
+    }
+    else {
+        print( $_[0], "\n" );
+    }
+}
+
+$myfun = sub {
+    print("Hello, World\n");
+};
diff --git a/t/snippets/expect/braces.braces3 b/t/snippets/expect/braces.braces3
new file mode 100644 (file)
index 0000000..bbce26f
--- /dev/null
@@ -0,0 +1,15 @@
+sub message
+  {
+    if ( !defined( $_[0] ) )
+      {
+        print("Hello, World\n");
+      }
+    else
+      {
+        print( $_[0], "\n" );
+      }
+  }
+
+$myfun = sub {
+    print("Hello, World\n");
+};
diff --git a/t/snippets/expect/braces.def b/t/snippets/expect/braces.def
new file mode 100644 (file)
index 0000000..8b93c94
--- /dev/null
@@ -0,0 +1,12 @@
+sub message {
+    if ( !defined( $_[0] ) ) {
+        print("Hello, World\n");
+    }
+    else {
+        print( $_[0], "\n" );
+    }
+}
+
+$myfun = sub {
+    print("Hello, World\n");
+};
index 5de00718a3cffc289f381890bef9168cb0212f91..ba95d6f09820b89d69a059b0c2edc00462bcd3c7 100644 (file)
@@ -1,22 +1,45 @@
 #!/usr/bin/perl -w
 # an initial hash bang line cannot be deleted with -dp
 sub length { return length( $_[0] ) }  # side comment
-                                       # hanging side comment
-                                       # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment
+
+# hanging side comment
+# very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment
 
 # side comments following open brace are not currently treated as hanging side comments
 sub macro_get_names {                  #
 #
 # %name = macro_get_names();  (key=macrohandle, value=macroname)
 #
-##local(%name);  # a static block comment
-    local (%name) = ();
+##local(%name);  # a static block comment without indentation
+    local (%name) = (); ## a static side comment to test -ssc
+
+# a spaced block comment to test -isbc
     for ( 0 .. $#mac_ver ) {
+
+# a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//;     # very long side comment; Clip off version number; we can use a newer version as well
+
     }
     %name;
 }
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+##  'Dec', 'Nov'   [a static block comment with indentation]
+    'Nov', 'Dec'
+);
+
+{                                      # this side comment will not align
+    my $IGNORE = 0;                    # This is a side comment
+
+# This is a hanging side comment
+# And so is this
+
+# A blank line interrupts the hsc's; this is a block comment
+
+}
+
 # side comments at different indentation levels should not normally be aligned
 {
     {
@@ -28,6 +51,14 @@ sub macro_get_names {                  #
     }                                  # end level 2
 }                                      # end level 1
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
 # some blank lines follow
 
 =pod
index da485912d90239818d5a7f145bf053233d38bb78..9de359bf5efcce2a491020aee90825af992e872d 100644 (file)
@@ -4,23 +4,47 @@ sub length { return length( $_[0] ) }          # side comment
  # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment
 
 sub macro_get_names {          #
-    local (%name) = ();
+    local (%name) = ();          ## a static side comment to test -ssc
+
     for ( 0 .. $#mac_ver ) {
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//
+          ; # very long side comment; Clip off version number; we can use a newer version as well
+
     }
     %name;
 }
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+    'Nov', 'Dec'
+);
+
+{           # this side comment will not align
+    my $IGNORE = 0;          # This is a side comment
+                             # This is a hanging side comment
+                             # And so is this
+
+}
+
 {
     {
         {
             {
                 { ${msg} = "Hello World!"; print "My message: ${msg}\n"; }
-            }          #end level 4
+            }                #end level 4
         }          # end level 3
     }          # end level 2
 }          # end level 1
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
 
 __END__
 
index 60b3059ef8f056dfa482c6c426283525fdd2c604..16e819be374eacd0b00d70b50d973de5427296d9 100644 (file)
@@ -6,30 +6,62 @@ sub length { return length( $_[0] ) }    # side comment
 
 # side comments following open brace are not currently treated as hanging side comments
 sub macro_get_names {    #
-    #
-    # %name = macro_get_names();  (key=macrohandle, value=macroname)
-    #
-##local(%name);  # a static block comment
-    local (%name) = ();
+#
+# %name = macro_get_names();  (key=macrohandle, value=macroname)
+#
+##local(%name);  # a static block comment without indentation
+    local (%name) = ();    ## a static side comment to test -ssc
+
+    # a spaced block comment to test -isbc
     for ( 0 .. $#mac_ver ) {
+
+# a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//
+          ; # very long side comment; Clip off version number; we can use a newer version as well
+
     }
     %name;
 }
 
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+    ##  'Dec', 'Nov'   [a static block comment with indentation]
+    'Nov', 'Dec'
+);
+
+
+{    # this side comment will not align
+    my $IGNORE = 0;    # This is a side comment
+                       # This is a hanging side comment
+                       # And so is this
+
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
+
 # side comments at different indentation levels should not normally be aligned
 {
     {
         {
             {
                 { ${msg} = "Hello World!"; print "My message: ${msg}\n"; }
-            }    #end level 4
+            }          #end level 4
         }    # end level 3
     }    # end level 2
 }    # end level 1
 
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
+
 # some blank lines follow
 
 
index 0216c3886f5dd33e81d8d20438e2366569a0ac48..a6d1e831f089c80eb4b3e47e056213720bf056e2 100644 (file)
@@ -9,16 +9,38 @@ sub macro_get_names {    #
     #
     # %name = macro_get_names();  (key=macrohandle, value=macroname)
     #
-##local(%name);  # a static block comment
-    local (%name) = ();
+##local(%name);  # a static block comment without indentation
+    local (%name) = ();    ## a static side comment to test -ssc
+
+    # a spaced block comment to test -isbc
     for ( 0 .. $#mac_ver ) {
+
+        # a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//
+          ; # very long side comment; Clip off version number; we can use a newer version as well
+
     }
     %name;
 }
 
 
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+  ##  'Dec', 'Nov'   [a static block comment with indentation]
+    'Nov', 'Dec'
+);
+
+
+{    # this side comment will not align
+    my $IGNORE = 0;    # This is a side comment
+                       # This is a hanging side comment
+                       # And so is this
+
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
 
 # side comments at different indentation levels should not normally be aligned
 {
@@ -26,12 +48,21 @@ sub macro_get_names {    #
         {
             {
                 { ${msg} = "Hello World!"; print "My message: ${msg}\n"; }
-            }    #end level 4
+            }          #end level 4
         }    # end level 3
     }    # end level 2
 }    # end level 1
 
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
+
 
 # some blank lines follow
 
index b21bbd17ba33d44ff6a5b56888c54001fbf94e61..04efd9c1f3f407037ce9a91cccde8237b255ff82 100644 (file)
@@ -7,14 +7,34 @@ sub macro_get_names {
     #
     # %name = macro_get_names();  (key=macrohandle, value=macroname)
     #
-##local(%name);  # a static block comment
+    ##local(%name);  # a static block comment without indentation
     local (%name) = ();
+
+    # a spaced block comment to test -isbc
     for ( 0 .. $#mac_ver ) {
+
+# a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//;
+
     }
     %name;
 }
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+
+    ##  'Dec', 'Nov'   [a static block comment with indentation]
+    'Nov', 'Dec'
+);
+
+{
+    my $IGNORE = 0;
+    
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
+
 # side comments at different indentation levels should not normally be aligned
 {
     {
@@ -26,6 +46,14 @@ sub macro_get_names {
     }
 }
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
 # some blank lines follow
 
 =pod
index 883c68b1bb8eb0d02d7c83221ec47db5bf9e021d..177ce345e28c8e14ecf801f3884f2296b01ed7da 100644 (file)
@@ -9,25 +9,55 @@ sub macro_get_names {    #
     #
     # %name = macro_get_names();  (key=macrohandle, value=macroname)
     #
-##local(%name);  # a static block comment
-    local (%name) = ();
+##local(%name);  # a static block comment without indentation
+    local (%name) = ();    ## a static side comment to test -ssc
+
+    # a spaced block comment to test -isbc
     for ( 0 .. $#mac_ver ) {
+
+# a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//
+          ; # very long side comment; Clip off version number; we can use a newer version as well
+
     }
     %name;
 }
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+    ##  'Dec', 'Nov'   [a static block comment with indentation]
+    'Nov', 'Dec'
+);
+
+{           # this side comment will not align
+    my $IGNORE = 0;    # This is a side comment
+                       # This is a hanging side comment
+                       # And so is this
+
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
+
 # side comments at different indentation levels should not normally be aligned
 {
     {
         {
             {
                 { ${msg} = "Hello World!"; print "My message: ${msg}\n"; }
-            }    #end level 4
+            }          #end level 4
         }    # end level 3
     }    # end level 2
 }    # end level 1
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
 # some blank lines follow
 
 =pod
diff --git a/t/snippets/expect/csc.csc1 b/t/snippets/expect/csc.csc1
new file mode 100644 (file)
index 0000000..e99b039
--- /dev/null
@@ -0,0 +1,8 @@
+        sub message {
+            if ( !defined( $_[0] ) ) {
+                print("Hello, World\n");
+            } ## end if ( !defined( $_[0] ))
+            else {
+                print( $_[0], "\n" );
+            } ## end else [ if ( !defined( $_[0] ))]
+        } ## end sub message
diff --git a/t/snippets/expect/csc.csc2 b/t/snippets/expect/csc.csc2
new file mode 100644 (file)
index 0000000..5d390ad
--- /dev/null
@@ -0,0 +1,8 @@
+        sub message {
+            if ( !defined( $_[0] ) ) {
+                print("Hello, World\n");
+            }
+            else {
+                print( $_[0], "\n" );
+            }
+        }
diff --git a/t/snippets/expect/csc.def b/t/snippets/expect/csc.def
new file mode 100644 (file)
index 0000000..87ba7a8
--- /dev/null
@@ -0,0 +1,8 @@
+        sub message {
+            if ( !defined( $_[0] ) ) {
+                print("Hello, World\n");
+            }
+            else {
+                print( $_[0], "\n" );
+            }
+        } ## end sub message
diff --git a/t/snippets/expect/iob.def b/t/snippets/expect/iob.def
new file mode 100644 (file)
index 0000000..181c341
--- /dev/null
@@ -0,0 +1,3 @@
+return "this is a descriptive error message"
+  if $res->is_error
+  or not length $data;
diff --git a/t/snippets/expect/iob.iob b/t/snippets/expect/iob.iob
new file mode 100644 (file)
index 0000000..3b41a53
--- /dev/null
@@ -0,0 +1,2 @@
+return "this is a descriptive error message"
+  if $res->is_error or not length $data;
diff --git a/t/snippets/expect/kis.def b/t/snippets/expect/kis.def
new file mode 100644 (file)
index 0000000..84cf03c
--- /dev/null
@@ -0,0 +1,4 @@
+    dbmclose(%verb_delim);
+    undef %verb_delim;
+    dbmclose(%expanded);
+    undef %expanded;
diff --git a/t/snippets/expect/kis.kis b/t/snippets/expect/kis.kis
new file mode 100644 (file)
index 0000000..25f1619
--- /dev/null
@@ -0,0 +1,2 @@
+    dbmclose(%verb_delim); undef %verb_delim;
+    dbmclose(%expanded);   undef %expanded;
diff --git a/t/snippets/expect/maths.def b/t/snippets/expect/maths.def
new file mode 100644 (file)
index 0000000..0bf2818
--- /dev/null
@@ -0,0 +1,15 @@
+$tmp =
+  $day - 32075 +
+  1461 * ( $year + 4800 - ( 14 - $month ) / 12 ) / 4 +
+  367 * ( $month - 2 + ( ( 14 - $month ) / 12 ) * 12 ) / 12 -
+  3 * ( ( $year + 4900 - ( 14 - $month ) / 12 ) / 100 ) / 4;
+
+return ( $r**$n ) *
+  ( pi**( $n / 2 ) ) /
+  (
+    sqrt(pi) *
+      factorial( 2 * ( int( $n / 2 ) ) + 2 ) /
+      factorial( int( $n / 2 ) + 1 ) /
+      ( 4**( int( $n / 2 ) + 1 ) ) );
+
+$root = -$b + sqrt( $b * $b - 4. * $a * $c ) / ( 2. * $a );
diff --git a/t/snippets/expect/maths.maths1 b/t/snippets/expect/maths.maths1
new file mode 100644 (file)
index 0000000..8a82115
--- /dev/null
@@ -0,0 +1,15 @@
+$tmp
+  =$day-32075
+  +1461*( $year+4800-( 14-$month )/12 )/4
+  +367*( $month-2+( ( 14-$month )/12 )*12 )/12
+  -3*( ( $year+4900-( 14-$month )/12 )/100 )/4;
+
+return ( $r**$n )
+  *( pi**( $n/2 ) )
+  /(
+    sqrt(pi)
+      *factorial( 2*( int( $n/2 ) )+2 )
+      /factorial( int( $n/2 )+1 )
+      /( 4**( int( $n/2 )+1 ) ) );
+
+$root=-$b+sqrt( $b*$b-4.*$a*$c )/( 2.*$a );
diff --git a/t/snippets/expect/maths.maths2 b/t/snippets/expect/maths.maths2
new file mode 100644 (file)
index 0000000..e46ca24
--- /dev/null
@@ -0,0 +1,15 @@
+$tmp=
+  $day-32075+
+  1461*( $year+4800-( 14-$month )/12 )/4+
+  367*( $month-2+( ( 14-$month )/12 )*12 )/12-
+  3*( ( $year+4900-( 14-$month )/12 )/100 )/4;
+
+return ( $r**$n )*
+  ( pi**( $n/2 ) )/
+  (
+    sqrt(pi)*
+      factorial( 2*( int( $n/2 ) )+2 )/
+      factorial( int( $n/2 )+1 )/
+      ( 4**( int( $n/2 )+1 ) ) );
+
+$root=-$b+sqrt( $b*$b-4.*$a*$c )/( 2.*$a );
diff --git a/t/snippets/expect/misc_tests.def b/t/snippets/expect/misc_tests.def
new file mode 100644 (file)
index 0000000..cac0a12
--- /dev/null
@@ -0,0 +1,5 @@
+for ( @a = @$ap, $u = shift @a ; @a ; $u = $v ) { ... }    # test -sfs
+$i = 1;                                                    #  test -sts
+$i = 0;                                                    ##  =1;  test -ssc
+;                                                          # test -ndsm
+my ( $a, $b, $c ) = @_;                                    # test -nsak="my for"
diff --git a/t/snippets/expect/misc_tests.misc_tests b/t/snippets/expect/misc_tests.misc_tests
new file mode 100644 (file)
index 0000000..4be7e2f
--- /dev/null
@@ -0,0 +1,8 @@
+for( @a = @$ap, $u = shift @a ; @a ; $u = $v ) { ...  }    # test -sfs
+$i = 1 ;                                                   #  test -sts
+$i = 0 ; ##  =1;  test -ssc
+;
+;
+;
+;                                                          # test -ndsm
+my( $a, $b, $c ) = @_ ;                                    # test -nsak="my for"
diff --git a/t/snippets/expect/outdent.def b/t/snippets/expect/outdent.def
new file mode 100644 (file)
index 0000000..3437dfa
--- /dev/null
@@ -0,0 +1,8 @@
+        # test -nola -okw
+        my $i;
+      LOOP: while ( $i = <FOTOS> ) {
+            chomp($i);
+            next unless $i;
+            fixit($i);
+        }
+
diff --git a/t/snippets/expect/outdent.outdent1 b/t/snippets/expect/outdent.outdent1
new file mode 100644 (file)
index 0000000..0952f6e
--- /dev/null
@@ -0,0 +1,8 @@
+        # test -nola -okw
+        my $i;
+        LOOP: while ( $i = <FOTOS> ) {
+            chomp($i);
+          next unless $i;
+            fixit($i);
+        }
+
diff --git a/t/snippets/expect/sbq.def b/t/snippets/expect/sbq.def
new file mode 100644 (file)
index 0000000..2671c31
--- /dev/null
@@ -0,0 +1,2 @@
+    $str1 = \"string1";
+    $str2 = \ 'string2';
diff --git a/t/snippets/expect/sbq.sbq0 b/t/snippets/expect/sbq.sbq0
new file mode 100644 (file)
index 0000000..38fb8e0
--- /dev/null
@@ -0,0 +1,2 @@
+    $str1 = \"string1";
+    $str2 = \'string2';
diff --git a/t/snippets/expect/sbq.sbq2 b/t/snippets/expect/sbq.sbq2
new file mode 100644 (file)
index 0000000..da73175
--- /dev/null
@@ -0,0 +1,2 @@
+    $str1 = \ "string1";
+    $str2 = \ 'string2';
diff --git a/t/snippets/expect/tightness.def b/t/snippets/expect/tightness.def
new file mode 100644 (file)
index 0000000..fb1a942
--- /dev/null
@@ -0,0 +1,4 @@
+if ( ( my $len_tab = length($tabstr) ) > 0 ) { }    # test -pt
+$width = $col[ $j + $k ] - $col[$j];                # test -sbt
+$obj->{ $parsed_sql->{'table'}[0] };                # test -bt
+%bf = map { $_ => -M $_ } grep { /\.deb$/ } dirents '.';    # test -bbt
diff --git a/t/snippets/expect/tightness.tightness1 b/t/snippets/expect/tightness.tightness1
new file mode 100644 (file)
index 0000000..9bb7359
--- /dev/null
@@ -0,0 +1,4 @@
+if ( ( my $len_tab = length( $tabstr ) ) > 0 ) { }    # test -pt
+$width = $col[ $j + $k ] - $col[ $j ];                # test -sbt
+$obj->{ $parsed_sql->{ 'table' }[ 0 ] };              # test -bt
+%bf = map { $_ => -M $_ } grep { /\.deb$/ } dirents '.';    # test -bbt
diff --git a/t/snippets/expect/tightness.tightness2 b/t/snippets/expect/tightness.tightness2
new file mode 100644 (file)
index 0000000..a5ed1a5
--- /dev/null
@@ -0,0 +1,4 @@
+if ( ( my $len_tab = length($tabstr) ) > 0 ) { }    # test -pt
+$width = $col[ $j + $k ] - $col[$j];                # test -sbt
+$obj->{ $parsed_sql->{'table'}[0] };                # test -bt
+%bf = map { $_ => -M $_ } grep {/\.deb$/} dirents '.';    # test -bbt
diff --git a/t/snippets/expect/tightness.tightness3 b/t/snippets/expect/tightness.tightness3
new file mode 100644 (file)
index 0000000..16c45bf
--- /dev/null
@@ -0,0 +1,4 @@
+if ((my $len_tab = length($tabstr)) > 0) { }    # test -pt
+$width = $col[$j + $k] - $col[$j];              # test -sbt
+$obj->{$parsed_sql->{'table'}[0]};              # test -bt
+%bf = map {$_ => -M $_} grep {/\.deb$/} dirents '.';    # test -bbt
diff --git a/t/snippets/iob.in b/t/snippets/iob.in
new file mode 100644 (file)
index 0000000..181c341
--- /dev/null
@@ -0,0 +1,3 @@
+return "this is a descriptive error message"
+  if $res->is_error
+  or not length $data;
diff --git a/t/snippets/iob.par b/t/snippets/iob.par
new file mode 100644 (file)
index 0000000..0cfc705
--- /dev/null
@@ -0,0 +1 @@
+-iob
diff --git a/t/snippets/kis.in b/t/snippets/kis.in
new file mode 100644 (file)
index 0000000..c11e51c
--- /dev/null
@@ -0,0 +1,2 @@
+    dbmclose(%verb_delim); undef %verb_delim;
+    dbmclose(%expanded); undef %expanded;
diff --git a/t/snippets/kis.par b/t/snippets/kis.par
new file mode 100644 (file)
index 0000000..486dd1e
--- /dev/null
@@ -0,0 +1 @@
+-kis
diff --git a/t/snippets/maths.in b/t/snippets/maths.in
new file mode 100644 (file)
index 0000000..a545508
--- /dev/null
@@ -0,0 +1,9 @@
+$tmp = $day - 32075 + 1461 * ( $year + 4800 - ( 14 - $month ) / 12 ) / 4 + 367
+* ( $month - 2 + ( ( 14 - $month ) / 12 ) * 12 ) / 12 - 3 * ( ( $year + 4900 -
+( 14 - $month ) / 12 ) / 100 ) / 4;
+
+return ( $r**$n ) * ( pi**( $n / 2 ) ) / ( sqrt(pi) * factorial( 2 * ( int( $n
+/ 2 ) ) + 2 ) / factorial( int( $n / 2 ) + 1 ) / ( 4**( int( $n / 2 ) + 1 ) )
+);
+
+$root=-$b+sqrt($b*$b-4.*$a*$c)/(2.*$a);
diff --git a/t/snippets/maths1.par b/t/snippets/maths1.par
new file mode 100644 (file)
index 0000000..02ae2b5
--- /dev/null
@@ -0,0 +1 @@
+-bbao -nwls="= + - / *"  -nwrs="= + - / *"
diff --git a/t/snippets/maths2.par b/t/snippets/maths2.par
new file mode 100644 (file)
index 0000000..7c8142f
--- /dev/null
@@ -0,0 +1 @@
+-baao -nwls="= + - / *"  -nwrs="= + - / *"
diff --git a/t/snippets/misc_tests.in b/t/snippets/misc_tests.in
new file mode 100644 (file)
index 0000000..0906d8c
--- /dev/null
@@ -0,0 +1,5 @@
+for ( @a = @$ap, $u = shift @a; @a; $u = $v ) { ... } # test -sfs 
+$i = 1 ;     #  test -sts
+$i = 0;    ##  =1;  test -ssc
+;;;; # test -ndsm
+my ( $a, $b, $c ) = @_;    # test -nsak="my for"
diff --git a/t/snippets/misc_tests.par b/t/snippets/misc_tests.par
new file mode 100644 (file)
index 0000000..0903f61
--- /dev/null
@@ -0,0 +1 @@
+-sts -ssc -sfs -nsak="my for" -ndsm
diff --git a/t/snippets/outdent.in b/t/snippets/outdent.in
new file mode 100644 (file)
index 0000000..b76a6f9
--- /dev/null
@@ -0,0 +1,8 @@
+# test -nola -okw
+        my $i;
+      LOOP: while ( $i = <FOTOS> ) {
+            chomp($i);
+            next unless $i;
+            fixit($i);
+        }
+
diff --git a/t/snippets/outdent1.par b/t/snippets/outdent1.par
new file mode 100644 (file)
index 0000000..e2ba763
--- /dev/null
@@ -0,0 +1 @@
+-nola -okw
index 776266deedae26863c5cea114486161a5e0ae07a..87fc4ae722b752b2572b54ec33e9a63f2607d4bc 100644 (file)
 ../snippets18.t        wn7.wn
 ../snippets18.t        wn8.def
 ../snippets18.t        wn8.wn
+../snippets18.t        comments.comments5
 ../snippets2.t angle.def
 ../snippets2.t arrows1.def
 ../snippets2.t arrows2.def
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
-../snippets18.t        comments.comments5
+../snippets18.t        braces.braces1
+../snippets18.t        braces.braces2
+../snippets18.t        braces.braces3
+../snippets18.t        braces.def
+../snippets18.t        csc.csc1
+../snippets18.t        csc.csc2
+../snippets18.t        csc.def
+../snippets18.t        iob.def
+../snippets18.t        iob.iob
+../snippets18.t        kis.def
+../snippets18.t        kis.kis
+../snippets18.t        maths.def
+../snippets18.t        maths.maths1
+../snippets18.t        maths.maths2
+../snippets18.t        misc_tests.def
+../snippets19.t        misc_tests.misc_tests
+../snippets19.t        outdent.def
+../snippets19.t        outdent.outdent1
+../snippets19.t        sbq.def
+../snippets19.t        sbq.sbq0
+../snippets19.t        sbq.sbq2
+../snippets19.t        tightness.def
+../snippets19.t        tightness.tightness1
+../snippets19.t        tightness.tightness2
+../snippets19.t        tightness.tightness3
diff --git a/t/snippets/sbq.in b/t/snippets/sbq.in
new file mode 100644 (file)
index 0000000..3835503
--- /dev/null
@@ -0,0 +1,2 @@
+       $str1=\"string1";
+       $str2=\ 'string2';
diff --git a/t/snippets/sbq0.par b/t/snippets/sbq0.par
new file mode 100644 (file)
index 0000000..052483e
--- /dev/null
@@ -0,0 +1 @@
+-sbq=0
diff --git a/t/snippets/sbq2.par b/t/snippets/sbq2.par
new file mode 100644 (file)
index 0000000..d288fee
--- /dev/null
@@ -0,0 +1 @@
+-sbq=2
diff --git a/t/snippets/tightness.in b/t/snippets/tightness.in
new file mode 100644 (file)
index 0000000..61a6e40
--- /dev/null
@@ -0,0 +1,4 @@
+if (( my $len_tab = length( $tabstr )  ) > 0) {  }  # test -pt
+$width = $col[ $j + $k ] - $col[ $j ]; # test -sbt
+$obj->{ $parsed_sql->{ 'table' }[0] };  # test -bt
+%bf = map { $_ => -M $_ } grep { /\.deb$/ } dirents '.';  # test -bbt
diff --git a/t/snippets/tightness1.par b/t/snippets/tightness1.par
new file mode 100644 (file)
index 0000000..50bcda0
--- /dev/null
@@ -0,0 +1 @@
+-pt=0 -sbt=0 -bt=0 -bbt=0
diff --git a/t/snippets/tightness2.par b/t/snippets/tightness2.par
new file mode 100644 (file)
index 0000000..bb6c411
--- /dev/null
@@ -0,0 +1,2 @@
+-pt=1 -sbt=1 -bt=1 -bbt=1
+
diff --git a/t/snippets/tightness3.par b/t/snippets/tightness3.par
new file mode 100644 (file)
index 0000000..a672acf
--- /dev/null
@@ -0,0 +1,2 @@
+-pt=2 -sbt=2 -bt=2 -bbt=2
+
index c9cddd74e4580d4e09c8856f854457b92477f206..ae38fd88167fa55e288756f484a829d8e3930bf4 100644 (file)
@@ -38,10 +38,10 @@ BEGIN {
     ###########################################
     $rparams = {
         'bos'       => "-bos",
-        'comments1' => "-fpsc=40 -iscl -nibc",
+        'comments1' => "-fpsc=40 -iscl -nibc -nhsc -ssc",
         'comments2' => "-msc=10 -dbc -dp",
-        'comments3' => "-mbl=2",
-        'comments4' => "-kbl=2",
+        'comments3' => "-mbl=2 -isbc",
+        'comments4' => "-kbl=2 -nolc -osbc",
         'def'       => "",
         'long_line' => "-l=0",
         'pbp'       => "-pbp -nst -nse",
@@ -78,16 +78,35 @@ sub macro_get_names { #
 # 
 # %name = macro_get_names();  (key=macrohandle, value=macroname)
 #
-##local(%name);  # a static block comment
-   local(%name)=();
+##local(%name);  # a static block comment without indentation
+   local(%name)=();  ## a static side comment to test -ssc
+
+ # a spaced block comment to test -isbc
    for (0..$                                          #mac_ver) {
+      # a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
       $name{$_} = $mac_ext[$idx{$mac_exti[$_]}];
+      $vmsfile =~ s/;[\d\-]*$//; # very long side comment; Clip off version number; we can use a newer version as well
+
    }
    %name;
 } 
 
 
 
+    @month_of_year = ( 
+        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+    ##  'Dec', 'Nov'   [a static block comment with indentation]
+        'Nov', 'Dec');
+
+
+{    # this side comment will not align
+    my $IGNORE = 0;    # This is a side comment
+                       # This is a hanging side comment
+                       # And so is this
+
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
 
 # side comments at different indentation levels should not normally be aligned
 { { { { { ${msg} = "Hello World!"; print "My message: ${msg}\n"; } } #end level 4
@@ -96,6 +115,15 @@ sub macro_get_names { #
 } # end level 1
 
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
+
 
 # some blank lines follow
 
@@ -254,22 +282,45 @@ ok IsWindow($c_sub_khwnd), 'IsWindow works on the client';
 #!/usr/bin/perl -w
 # an initial hash bang line cannot be deleted with -dp
 sub length { return length( $_[0] ) }  # side comment
-                                       # hanging side comment
-                                       # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment
+
+# hanging side comment
+# very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment
 
 # side comments following open brace are not currently treated as hanging side comments
 sub macro_get_names {                  #
 #
 # %name = macro_get_names();  (key=macrohandle, value=macroname)
 #
-##local(%name);  # a static block comment
-    local (%name) = ();
+##local(%name);  # a static block comment without indentation
+    local (%name) = (); ## a static side comment to test -ssc
+
+# a spaced block comment to test -isbc
     for ( 0 .. $#mac_ver ) {
+
+# a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//;     # very long side comment; Clip off version number; we can use a newer version as well
+
     }
     %name;
 }
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+##  'Dec', 'Nov'   [a static block comment with indentation]
+    'Nov', 'Dec'
+);
+
+{                                      # this side comment will not align
+    my $IGNORE = 0;                    # This is a side comment
+
+# This is a hanging side comment
+# And so is this
+
+# A blank line interrupts the hsc's; this is a block comment
+
+}
+
 # side comments at different indentation levels should not normally be aligned
 {
     {
@@ -281,6 +332,14 @@ sub macro_get_names {                  #
     }                                  # end level 2
 }                                      # end level 1
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
 # some blank lines follow
 
 =pod
@@ -311,23 +370,47 @@ sub length { return length( $_[0] ) }          # side comment
  # very longgggggggggggggggggggggggggggggggggggggggggggggggggggg hanging side comment
 
 sub macro_get_names {          #
-    local (%name) = ();
+    local (%name) = ();          ## a static side comment to test -ssc
+
     for ( 0 .. $#mac_ver ) {
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//
+          ; # very long side comment; Clip off version number; we can use a newer version as well
+
     }
     %name;
 }
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+    'Nov', 'Dec'
+);
+
+{           # this side comment will not align
+    my $IGNORE = 0;          # This is a side comment
+                             # This is a hanging side comment
+                             # And so is this
+
+}
+
 {
     {
         {
             {
                 { ${msg} = "Hello World!"; print "My message: ${msg}\n"; }
-            }          #end level 4
+            }                #end level 4
         }          # end level 3
     }          # end level 2
 }          # end level 1
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
 
 __END__
 
@@ -352,30 +435,62 @@ sub length { return length( $_[0] ) }    # side comment
 
 # side comments following open brace are not currently treated as hanging side comments
 sub macro_get_names {    #
-    #
-    # %name = macro_get_names();  (key=macrohandle, value=macroname)
-    #
-##local(%name);  # a static block comment
-    local (%name) = ();
+#
+# %name = macro_get_names();  (key=macrohandle, value=macroname)
+#
+##local(%name);  # a static block comment without indentation
+    local (%name) = ();    ## a static side comment to test -ssc
+
+    # a spaced block comment to test -isbc
     for ( 0 .. $#mac_ver ) {
+
+# a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//
+          ; # very long side comment; Clip off version number; we can use a newer version as well
+
     }
     %name;
 }
 
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+    ##  'Dec', 'Nov'   [a static block comment with indentation]
+    'Nov', 'Dec'
+);
+
+
+{    # this side comment will not align
+    my $IGNORE = 0;    # This is a side comment
+                       # This is a hanging side comment
+                       # And so is this
+
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
+
 # side comments at different indentation levels should not normally be aligned
 {
     {
         {
             {
                 { ${msg} = "Hello World!"; print "My message: ${msg}\n"; }
-            }    #end level 4
+            }          #end level 4
         }    # end level 3
     }    # end level 2
 }    # end level 1
 
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
+
 # some blank lines follow
 
 
@@ -413,16 +528,38 @@ sub macro_get_names {    #
     #
     # %name = macro_get_names();  (key=macrohandle, value=macroname)
     #
-##local(%name);  # a static block comment
-    local (%name) = ();
+##local(%name);  # a static block comment without indentation
+    local (%name) = ();    ## a static side comment to test -ssc
+
+    # a spaced block comment to test -isbc
     for ( 0 .. $#mac_ver ) {
+
+        # a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//
+          ; # very long side comment; Clip off version number; we can use a newer version as well
+
     }
     %name;
 }
 
 
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+  ##  'Dec', 'Nov'   [a static block comment with indentation]
+    'Nov', 'Dec'
+);
+
+
+{    # this side comment will not align
+    my $IGNORE = 0;    # This is a side comment
+                       # This is a hanging side comment
+                       # And so is this
+
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
 
 # side comments at different indentation levels should not normally be aligned
 {
@@ -430,12 +567,21 @@ sub macro_get_names {    #
         {
             {
                 { ${msg} = "Hello World!"; print "My message: ${msg}\n"; }
-            }    #end level 4
+            }          #end level 4
         }    # end level 3
     }    # end level 2
 }    # end level 1
 
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
+
 
 # some blank lines follow
 
@@ -475,25 +621,55 @@ sub macro_get_names {    #
     #
     # %name = macro_get_names();  (key=macrohandle, value=macroname)
     #
-##local(%name);  # a static block comment
-    local (%name) = ();
+##local(%name);  # a static block comment without indentation
+    local (%name) = ();    ## a static side comment to test -ssc
+
+    # a spaced block comment to test -isbc
     for ( 0 .. $#mac_ver ) {
+
+# a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//
+          ; # very long side comment; Clip off version number; we can use a newer version as well
+
     }
     %name;
 }
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+    ##  'Dec', 'Nov'   [a static block comment with indentation]
+    'Nov', 'Dec'
+);
+
+{           # this side comment will not align
+    my $IGNORE = 0;    # This is a side comment
+                       # This is a hanging side comment
+                       # And so is this
+
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
+
 # side comments at different indentation levels should not normally be aligned
 {
     {
         {
             {
                 { ${msg} = "Hello World!"; print "My message: ${msg}\n"; }
-            }    #end level 4
+            }          #end level 4
         }    # end level 3
     }    # end level 2
 }    # end level 1
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
 # some blank lines follow
 
 =pod
index 30d7ae354e857de56c6a793447cb7f3cfa077ee3..89f78edfe8d594cde8084ba44b4595cd58b988ad 100644 (file)
@@ -5,6 +5,21 @@
 #2 wn8.def
 #3 wn8.wn
 #4 comments.comments5
+#5 braces.braces1
+#6 braces.braces2
+#7 braces.braces3
+#8 braces.def
+#9 csc.csc1
+#10 csc.csc2
+#11 csc.def
+#12 iob.def
+#13 iob.iob
+#14 kis.def
+#15 kis.kis
+#16 maths.def
+#17 maths.maths1
+#18 maths.maths2
+#19 misc_tests.def
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -22,9 +37,22 @@ BEGIN {
     # BEGIN SECTION 1: Parameter combinations #
     ###########################################
     $rparams = {
-        'comments5' => "-dsc",
+        'braces1'   => "-bl -asbl",
+        'braces2'   => "-sbl",
+        'braces3'   => "-bli",
+        'comments5' => "-dsc -nsbc",
+        'csc1'      => "-csc -csci=2 -cscb",
+        'csc2'      => "-dcsc",
         'def'       => "",
-        'wn'        => "-wn",
+        'iob'       => "-iob",
+        'kis'       => "-kis",
+        'maths1'    => <<'----------',
+-bbao -nwls="= + - / *"  -nwrs="= + - / *"
+----------
+        'maths2' => <<'----------',
+-baao -nwls="= + - / *"  -nwrs="= + - / *"
+----------
+        'wn' => "-wn",
     };
 
     ############################
@@ -32,6 +60,21 @@ BEGIN {
     ############################
     $rsources = {
 
+        'braces' => <<'----------',
+sub message {
+    if ( !defined( $_[0] ) ) {
+        print("Hello, World\n");
+    }
+    else {
+        print( $_[0], "\n" );
+    }
+}
+
+$myfun = sub {
+    print("Hello, World\n");
+};
+----------
+
         'comments' => <<'----------',
 #!/usr/bin/perl -w
 # an initial hash bang line cannot be deleted with -dp
@@ -44,16 +87,35 @@ sub macro_get_names { #
 # 
 # %name = macro_get_names();  (key=macrohandle, value=macroname)
 #
-##local(%name);  # a static block comment
-   local(%name)=();
+##local(%name);  # a static block comment without indentation
+   local(%name)=();  ## a static side comment to test -ssc
+
+ # a spaced block comment to test -isbc
    for (0..$                                          #mac_ver) {
+      # a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
       $name{$_} = $mac_ext[$idx{$mac_exti[$_]}];
+      $vmsfile =~ s/;[\d\-]*$//; # very long side comment; Clip off version number; we can use a newer version as well
+
    }
    %name;
 } 
 
 
 
+    @month_of_year = ( 
+        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+    ##  'Dec', 'Nov'   [a static block comment with indentation]
+        'Nov', 'Dec');
+
+
+{    # this side comment will not align
+    my $IGNORE = 0;    # This is a side comment
+                       # This is a hanging side comment
+                       # And so is this
+
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
 
 # side comments at different indentation levels should not normally be aligned
 { { { { { ${msg} = "Hello World!"; print "My message: ${msg}\n"; } } #end level 4
@@ -62,6 +124,15 @@ sub macro_get_names { #
 } # end level 1
 
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
+
 
 # some blank lines follow
 
@@ -83,6 +154,48 @@ Some pod after  __END__ to delete with -dp
 =cut
 
 
+----------
+
+        'csc' => <<'----------',
+        sub message {
+            if ( !defined( $_[0] ) ) {
+                print("Hello, World\n");
+            }
+            else {
+                print( $_[0], "\n" );
+            }
+        } ## end sub message
+----------
+
+        'iob' => <<'----------',
+return "this is a descriptive error message"
+  if $res->is_error
+  or not length $data;
+----------
+
+        'kis' => <<'----------',
+    dbmclose(%verb_delim); undef %verb_delim;
+    dbmclose(%expanded); undef %expanded;
+----------
+
+        'maths' => <<'----------',
+$tmp = $day - 32075 + 1461 * ( $year + 4800 - ( 14 - $month ) / 12 ) / 4 + 367
+* ( $month - 2 + ( ( 14 - $month ) / 12 ) * 12 ) / 12 - 3 * ( ( $year + 4900 -
+( 14 - $month ) / 12 ) / 100 ) / 4;
+
+return ( $r**$n ) * ( pi**( $n / 2 ) ) / ( sqrt(pi) * factorial( 2 * ( int( $n
+/ 2 ) ) + 2 ) / factorial( int( $n / 2 ) + 1 ) / ( 4**( int( $n / 2 ) + 1 ) )
+);
+
+$root=-$b+sqrt($b*$b-4.*$a*$c)/(2.*$a);
+----------
+
+        'misc_tests' => <<'----------',
+for ( @a = @$ap, $u = shift @a; @a; $u = $v ) { ... } # test -sfs 
+$i = 1 ;     #  test -sts
+$i = 0;    ##  =1;  test -ssc
+;;;; # test -ndsm
+my ( $a, $b, $c ) = @_;    # test -nsak="my for"
 ----------
 
         'wn7' => <<'----------',
@@ -202,14 +315,34 @@ sub macro_get_names {
     #
     # %name = macro_get_names();  (key=macrohandle, value=macroname)
     #
-##local(%name);  # a static block comment
+    ##local(%name);  # a static block comment without indentation
     local (%name) = ();
+
+    # a spaced block comment to test -isbc
     for ( 0 .. $#mac_ver ) {
+
+# a very long comment for testing the parameter --nooutdent-long-comments (or -nolc)
         $name{$_} = $mac_ext[ $idx{ $mac_exti[$_] } ];
+        $vmsfile =~ s/;[\d\-]*$//;
+
     }
     %name;
 }
 
+@month_of_year = (
+    'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
+
+    ##  'Dec', 'Nov'   [a static block comment with indentation]
+    'Nov', 'Dec'
+);
+
+{
+    my $IGNORE = 0;
+    
+    # A blank line interrupts the hsc's; this is a block comment
+
+}
+
 # side comments at different indentation levels should not normally be aligned
 {
     {
@@ -221,6 +354,14 @@ sub macro_get_names {
     }
 }
 
+#<<<  do not let perltidy touch this
+    my @list = (1,
+                1, 1,
+                1, 2, 1,
+                1, 3, 3, 1,
+                1, 4, 6, 4, 1,);
+#>>>
+
 # some blank lines follow
 
 =pod
@@ -240,6 +381,252 @@ Some pod after  __END__ to delete with -dp
 
 #4...........
         },
+
+        'braces.braces1' => {
+            source => "braces",
+            params => "braces1",
+            expect => <<'#5...........',
+sub message
+{
+    if ( !defined( $_[0] ) )
+    {
+        print("Hello, World\n");
+    }
+    else
+    {
+        print( $_[0], "\n" );
+    }
+}
+
+$myfun = sub
+{
+    print("Hello, World\n");
+};
+#5...........
+        },
+
+        'braces.braces2' => {
+            source => "braces",
+            params => "braces2",
+            expect => <<'#6...........',
+sub message
+{
+    if ( !defined( $_[0] ) ) {
+        print("Hello, World\n");
+    }
+    else {
+        print( $_[0], "\n" );
+    }
+}
+
+$myfun = sub {
+    print("Hello, World\n");
+};
+#6...........
+        },
+
+        'braces.braces3' => {
+            source => "braces",
+            params => "braces3",
+            expect => <<'#7...........',
+sub message
+  {
+    if ( !defined( $_[0] ) )
+      {
+        print("Hello, World\n");
+      }
+    else
+      {
+        print( $_[0], "\n" );
+      }
+  }
+
+$myfun = sub {
+    print("Hello, World\n");
+};
+#7...........
+        },
+
+        'braces.def' => {
+            source => "braces",
+            params => "def",
+            expect => <<'#8...........',
+sub message {
+    if ( !defined( $_[0] ) ) {
+        print("Hello, World\n");
+    }
+    else {
+        print( $_[0], "\n" );
+    }
+}
+
+$myfun = sub {
+    print("Hello, World\n");
+};
+#8...........
+        },
+
+        'csc.csc1' => {
+            source => "csc",
+            params => "csc1",
+            expect => <<'#9...........',
+        sub message {
+            if ( !defined( $_[0] ) ) {
+                print("Hello, World\n");
+            } ## end if ( !defined( $_[0] ))
+            else {
+                print( $_[0], "\n" );
+            } ## end else [ if ( !defined( $_[0] ))]
+        } ## end sub message
+#9...........
+        },
+
+        'csc.csc2' => {
+            source => "csc",
+            params => "csc2",
+            expect => <<'#10...........',
+        sub message {
+            if ( !defined( $_[0] ) ) {
+                print("Hello, World\n");
+            }
+            else {
+                print( $_[0], "\n" );
+            }
+        }
+#10...........
+        },
+
+        'csc.def' => {
+            source => "csc",
+            params => "def",
+            expect => <<'#11...........',
+        sub message {
+            if ( !defined( $_[0] ) ) {
+                print("Hello, World\n");
+            }
+            else {
+                print( $_[0], "\n" );
+            }
+        } ## end sub message
+#11...........
+        },
+
+        'iob.def' => {
+            source => "iob",
+            params => "def",
+            expect => <<'#12...........',
+return "this is a descriptive error message"
+  if $res->is_error
+  or not length $data;
+#12...........
+        },
+
+        'iob.iob' => {
+            source => "iob",
+            params => "iob",
+            expect => <<'#13...........',
+return "this is a descriptive error message"
+  if $res->is_error or not length $data;
+#13...........
+        },
+
+        'kis.def' => {
+            source => "kis",
+            params => "def",
+            expect => <<'#14...........',
+    dbmclose(%verb_delim);
+    undef %verb_delim;
+    dbmclose(%expanded);
+    undef %expanded;
+#14...........
+        },
+
+        'kis.kis' => {
+            source => "kis",
+            params => "kis",
+            expect => <<'#15...........',
+    dbmclose(%verb_delim); undef %verb_delim;
+    dbmclose(%expanded);   undef %expanded;
+#15...........
+        },
+
+        'maths.def' => {
+            source => "maths",
+            params => "def",
+            expect => <<'#16...........',
+$tmp =
+  $day - 32075 +
+  1461 * ( $year + 4800 - ( 14 - $month ) / 12 ) / 4 +
+  367 * ( $month - 2 + ( ( 14 - $month ) / 12 ) * 12 ) / 12 -
+  3 * ( ( $year + 4900 - ( 14 - $month ) / 12 ) / 100 ) / 4;
+
+return ( $r**$n ) *
+  ( pi**( $n / 2 ) ) /
+  (
+    sqrt(pi) *
+      factorial( 2 * ( int( $n / 2 ) ) + 2 ) /
+      factorial( int( $n / 2 ) + 1 ) /
+      ( 4**( int( $n / 2 ) + 1 ) ) );
+
+$root = -$b + sqrt( $b * $b - 4. * $a * $c ) / ( 2. * $a );
+#16...........
+        },
+
+        'maths.maths1' => {
+            source => "maths",
+            params => "maths1",
+            expect => <<'#17...........',
+$tmp
+  =$day-32075
+  +1461*( $year+4800-( 14-$month )/12 )/4
+  +367*( $month-2+( ( 14-$month )/12 )*12 )/12
+  -3*( ( $year+4900-( 14-$month )/12 )/100 )/4;
+
+return ( $r**$n )
+  *( pi**( $n/2 ) )
+  /(
+    sqrt(pi)
+      *factorial( 2*( int( $n/2 ) )+2 )
+      /factorial( int( $n/2 )+1 )
+      /( 4**( int( $n/2 )+1 ) ) );
+
+$root=-$b+sqrt( $b*$b-4.*$a*$c )/( 2.*$a );
+#17...........
+        },
+
+        'maths.maths2' => {
+            source => "maths",
+            params => "maths2",
+            expect => <<'#18...........',
+$tmp=
+  $day-32075+
+  1461*( $year+4800-( 14-$month )/12 )/4+
+  367*( $month-2+( ( 14-$month )/12 )*12 )/12-
+  3*( ( $year+4900-( 14-$month )/12 )/100 )/4;
+
+return ( $r**$n )*
+  ( pi**( $n/2 ) )/
+  (
+    sqrt(pi)*
+      factorial( 2*( int( $n/2 ) )+2 )/
+      factorial( int( $n/2 )+1 )/
+      ( 4**( int( $n/2 )+1 ) ) );
+
+$root=-$b+sqrt( $b*$b-4.*$a*$c )/( 2.*$a );
+#18...........
+        },
+
+        'misc_tests.def' => {
+            source => "misc_tests",
+            params => "def",
+            expect => <<'#19...........',
+for ( @a = @$ap, $u = shift @a ; @a ; $u = $v ) { ... }    # test -sfs
+$i = 1;                                                    #  test -sts
+$i = 0;                                                    ##  =1;  test -ssc
+;                                                          # test -ndsm
+my ( $a, $b, $c ) = @_;                                    # test -nsak="my for"
+#19...........
+        },
     };
 
     my $ntests = 0 + keys %{$rtests};
diff --git a/t/snippets19.t b/t/snippets19.t
new file mode 100644 (file)
index 0000000..38f229a
--- /dev/null
@@ -0,0 +1,259 @@
+# Created with: ./make_t.pl
+
+# Contents:
+#1 misc_tests.misc_tests
+#2 outdent.def
+#3 outdent.outdent1
+#4 sbq.def
+#5 sbq.sbq0
+#6 sbq.sbq2
+#7 tightness.def
+#8 tightness.tightness1
+#9 tightness.tightness2
+#10 tightness.tightness3
+
+# To locate test #13 you can search for its name or the string '#13'
+
+use strict;
+use Test;
+use Carp;
+use Perl::Tidy;
+my $rparams;
+my $rsources;
+my $rtests;
+
+BEGIN {
+
+    ###########################################
+    # BEGIN SECTION 1: Parameter combinations #
+    ###########################################
+    $rparams = {
+        'def'        => "",
+        'misc_tests' => <<'----------',
+-sts -ssc -sfs -nsak="my for" -ndsm
+----------
+        'outdent1'   => "-nola -okw",
+        'sbq0'       => "-sbq=0",
+        'sbq2'       => "-sbq=2",
+        'tightness1' => "-pt=0 -sbt=0 -bt=0 -bbt=0",
+        'tightness2' => <<'----------',
+-pt=1 -sbt=1 -bt=1 -bbt=1
+
+----------
+        'tightness3' => <<'----------',
+-pt=2 -sbt=2 -bt=2 -bbt=2
+
+----------
+    };
+
+    ############################
+    # BEGIN SECTION 2: Sources #
+    ############################
+    $rsources = {
+
+        'misc_tests' => <<'----------',
+for ( @a = @$ap, $u = shift @a; @a; $u = $v ) { ... } # test -sfs 
+$i = 1 ;     #  test -sts
+$i = 0;    ##  =1;  test -ssc
+;;;; # test -ndsm
+my ( $a, $b, $c ) = @_;    # test -nsak="my for"
+----------
+
+        'outdent' => <<'----------',
+# test -nola -okw
+        my $i;
+      LOOP: while ( $i = <FOTOS> ) {
+            chomp($i);
+            next unless $i;
+            fixit($i);
+        }
+
+----------
+
+        'sbq' => <<'----------',
+       $str1=\"string1";
+       $str2=\ 'string2';
+----------
+
+        'tightness' => <<'----------',
+if (( my $len_tab = length( $tabstr )  ) > 0) {  }  # test -pt
+$width = $col[ $j + $k ] - $col[ $j ]; # test -sbt
+$obj->{ $parsed_sql->{ 'table' }[0] };  # test -bt
+%bf = map { $_ => -M $_ } grep { /\.deb$/ } dirents '.';  # test -bbt
+----------
+    };
+
+    ####################################
+    # BEGIN SECTION 3: Expected output #
+    ####################################
+    $rtests = {
+
+        'misc_tests.misc_tests' => {
+            source => "misc_tests",
+            params => "misc_tests",
+            expect => <<'#1...........',
+for( @a = @$ap, $u = shift @a ; @a ; $u = $v ) { ...  }    # test -sfs
+$i = 1 ;                                                   #  test -sts
+$i = 0 ; ##  =1;  test -ssc
+;
+;
+;
+;                                                          # test -ndsm
+my( $a, $b, $c ) = @_ ;                                    # test -nsak="my for"
+#1...........
+        },
+
+        'outdent.def' => {
+            source => "outdent",
+            params => "def",
+            expect => <<'#2...........',
+        # test -nola -okw
+        my $i;
+      LOOP: while ( $i = <FOTOS> ) {
+            chomp($i);
+            next unless $i;
+            fixit($i);
+        }
+
+#2...........
+        },
+
+        'outdent.outdent1' => {
+            source => "outdent",
+            params => "outdent1",
+            expect => <<'#3...........',
+        # test -nola -okw
+        my $i;
+        LOOP: while ( $i = <FOTOS> ) {
+            chomp($i);
+          next unless $i;
+            fixit($i);
+        }
+
+#3...........
+        },
+
+        'sbq.def' => {
+            source => "sbq",
+            params => "def",
+            expect => <<'#4...........',
+    $str1 = \"string1";
+    $str2 = \ 'string2';
+#4...........
+        },
+
+        'sbq.sbq0' => {
+            source => "sbq",
+            params => "sbq0",
+            expect => <<'#5...........',
+    $str1 = \"string1";
+    $str2 = \'string2';
+#5...........
+        },
+
+        'sbq.sbq2' => {
+            source => "sbq",
+            params => "sbq2",
+            expect => <<'#6...........',
+    $str1 = \ "string1";
+    $str2 = \ 'string2';
+#6...........
+        },
+
+        'tightness.def' => {
+            source => "tightness",
+            params => "def",
+            expect => <<'#7...........',
+if ( ( my $len_tab = length($tabstr) ) > 0 ) { }    # test -pt
+$width = $col[ $j + $k ] - $col[$j];                # test -sbt
+$obj->{ $parsed_sql->{'table'}[0] };                # test -bt
+%bf = map { $_ => -M $_ } grep { /\.deb$/ } dirents '.';    # test -bbt
+#7...........
+        },
+
+        'tightness.tightness1' => {
+            source => "tightness",
+            params => "tightness1",
+            expect => <<'#8...........',
+if ( ( my $len_tab = length( $tabstr ) ) > 0 ) { }    # test -pt
+$width = $col[ $j + $k ] - $col[ $j ];                # test -sbt
+$obj->{ $parsed_sql->{ 'table' }[ 0 ] };              # test -bt
+%bf = map { $_ => -M $_ } grep { /\.deb$/ } dirents '.';    # test -bbt
+#8...........
+        },
+
+        'tightness.tightness2' => {
+            source => "tightness",
+            params => "tightness2",
+            expect => <<'#9...........',
+if ( ( my $len_tab = length($tabstr) ) > 0 ) { }    # test -pt
+$width = $col[ $j + $k ] - $col[$j];                # test -sbt
+$obj->{ $parsed_sql->{'table'}[0] };                # test -bt
+%bf = map { $_ => -M $_ } grep {/\.deb$/} dirents '.';    # test -bbt
+#9...........
+        },
+
+        'tightness.tightness3' => {
+            source => "tightness",
+            params => "tightness3",
+            expect => <<'#10...........',
+if ((my $len_tab = length($tabstr)) > 0) { }    # test -pt
+$width = $col[$j + $k] - $col[$j];              # test -sbt
+$obj->{$parsed_sql->{'table'}[0]};              # test -bt
+%bf = map {$_ => -M $_} grep {/\.deb$/} dirents '.';    # test -bbt
+#10...........
+        },
+    };
+
+    my $ntests = 0 + keys %{$rtests};
+    plan tests => $ntests;
+}
+
+###############
+# EXECUTE TESTS
+###############
+
+foreach my $key ( sort keys %{$rtests} ) {
+    my $output;
+    my $sname  = $rtests->{$key}->{source};
+    my $expect = $rtests->{$key}->{expect};
+    my $pname  = $rtests->{$key}->{params};
+    my $source = $rsources->{$sname};
+    my $params = defined($pname) ? $rparams->{$pname} : "";
+    my $stderr_string;
+    my $errorfile_string;
+    my $err = Perl::Tidy::perltidy(
+        source      => \$source,
+        destination => \$output,
+        perltidyrc  => \$params,
+        argv        => '',             # for safety; hide any ARGV from perltidy
+        stderr      => \$stderr_string,
+        errorfile => \$errorfile_string,    # not used when -se flag is set
+    );
+    if ( $err || $stderr_string || $errorfile_string ) {
+        if ($err) {
+            print STDERR
+"This error received calling Perl::Tidy with '$sname' + '$pname'\n";
+            ok( !$err );
+        }
+        if ($stderr_string) {
+            print STDERR "---------------------\n";
+            print STDERR "<<STDERR>>\n$stderr_string\n";
+            print STDERR "---------------------\n";
+            print STDERR
+"This error received calling Perl::Tidy with '$sname' + '$pname'\n";
+            ok( !$stderr_string );
+        }
+        if ($errorfile_string) {
+            print STDERR "---------------------\n";
+            print STDERR "<<.ERR file>>\n$errorfile_string\n";
+            print STDERR "---------------------\n";
+            print STDERR
+"This error received calling Perl::Tidy with '$sname' + '$pname'\n";
+            ok( !$errorfile_string );
+        }
+    }
+    else {
+        ok( $output, $expect );
+    }
+}