]> git.donarmstrong.com Git - perltidy.git/commitdiff
add test case
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 2 May 2024 00:50:41 +0000 (17:50 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 2 May 2024 00:50:41 +0000 (17:50 -0700)
.gitignore
t/snippets/ame.par
t/snippets/coverage_missing.txt
t/snippets/coverage_values.txt [deleted file]
t/snippets/expect/ame.ame
t/snippets/expect/vsn.vsn3 [new file with mode: 0644]
t/snippets/packing_list.txt
t/snippets/vsn3.par [new file with mode: 0644]
t/snippets28.t
t/snippets29.t

index 7b07514aaea8a9873b964a88a294971e0210c28d..23ee0c22be3a57ac8a9affb619a7d1663f06d9af 100644 (file)
@@ -28,3 +28,4 @@ perltidy-*.pl
 perltidy.pl
 pm_to_blib
 tmp*/
+t/snippets/coverage_values.txt
index 51c5b0854276575307ffa693a1e4b0df7d77c1a3..9559c04aa764cd6907cc0948b782dfd956dcb4cc 100644 (file)
@@ -1 +1,2 @@
 --add-missing-else
+--add-missing-else-comment="NEED COMMENT"
index b747cbec473f298b603607df0c87ef8b8004a9dc..04eabd7d40f4884e29e7666eb388c47e38468010 100644 (file)
@@ -10,19 +10,23 @@ closing-side-comment-prefix
 closing-side-comment-warnings
 closing-token-indentation
 code-skipping
-code-skipping-begin
-code-skipping-end
 cuddled-block-list-exclusive
+dump-block-summary
 dump-cuddled-block-list
 dump-defaults
+dump-integer-option-range
 dump-long-names
+dump-mismatched-args
+dump-mixed-call-parens
 dump-options
 dump-profile
 dump-short-names
 dump-token-types
+dump-unusual-variables
 dump-want-left-space
 dump-want-right-space
 encode-output-strings
+experimental
 extended-syntax
 file-size-order
 force-read-binary
@@ -104,12 +108,14 @@ no-profile
 nohtml-style-sheets
 noprofile
 notidy
+nowant-call-parens
 npro
 outfile
 output-file-extension
 output-line-ending
 output-path
 pass-version-line
+perl-syntax-check-flags
 pod2html
 podflush
 podheader
@@ -130,6 +136,15 @@ tee-pod
 tee-side-comments
 title
 trim-qw
+use-feature
 use-unicode-gcstring
 version
 vertical-tightness
+want-call-parens
+warn-interbracket-arrows
+warn-mismatched-arg-exclusion-list
+warn-mismatched-arg-types
+warn-mismatched-args
+warn-missing-else
+warn-variable-exclusion-list
+warn-variable-types
diff --git a/t/snippets/coverage_values.txt b/t/snippets/coverage_values.txt
deleted file mode 100644 (file)
index e4d7c33..0000000
+++ /dev/null
@@ -1,727 +0,0 @@
-$VAR1 = {
-          'one-line-block-semicolons' => [
-                                           0,
-                                           1,
-                                           2
-                                         ],
-          'break-after-labels' => [
-                                    0,
-                                    1,
-                                    2
-                                  ],
-          'maximum-unexpected-errors' => [
-                                           0
-                                         ],
-          'valign-code' => [
-                             0,
-                             1
-                           ],
-          'delete-semicolons' => [
-                                   0,
-                                   1
-                                 ],
-          'check-syntax' => [
-                              0,
-                              1
-                            ],
-          'break-before-hash-brace' => [
-                                         0,
-                                         2,
-                                         3
-                                       ],
-          'stack-opening-hash-brace' => [
-                                          0,
-                                          1
-                                        ],
-          'stack-closing-paren' => [
-                                     0,
-                                     1
-                                   ],
-          'recombine' => [
-                           0,
-                           1
-                         ],
-          'timestamp' => [
-                           0,
-                           1
-                         ],
-          'look-for-hash-bang' => [
-                                    0,
-                                    1
-                                  ],
-          'space-backslash-quote' => [
-                                       0,
-                                       1,
-                                       2
-                                     ],
-          'outdent-labels' => [
-                                0,
-                                1
-                              ],
-          'break-at-old-ternary-breakpoints' => [
-                                                  0,
-                                                  1
-                                                ],
-          'delete-old-whitespace' => [
-                                       0,
-                                       1
-                                     ],
-          'closing-square-bracket-indentation' => [
-                                                    0,
-                                                    1,
-                                                    2
-                                                  ],
-          'break-at-old-logical-breakpoints' => [
-                                                  0,
-                                                  1
-                                                ],
-          'blank-lines-before-subs' => [
-                                         0,
-                                         1
-                                       ],
-          'format-skipping-end' => [
-                                     '#>{2,}'
-                                   ],
-          'keyword-paren-inner-tightness-list' => [
-                                                    'return factorial'
-                                                  ],
-          'opening-sub-brace-on-new-line' => [
-                                               0,
-                                               1
-                                             ],
-          'maximum-fields-per-table' => [
-                                          0
-                                        ],
-          'closing-side-comment-interval' => [
-                                               2,
-                                               20,
-                                               6
-                                             ],
-          'closing-paren-indentation' => [
-                                           0,
-                                           1,
-                                           2
-                                         ],
-          'nowant-left-space' => [
-                                   '+ - / *',
-                                   '++ -- ?',
-                                   '..',
-                                   '= + - / *',
-                                   '= / *'
-                                 ],
-          'opening-brace-on-new-line' => [
-                                           0,
-                                           1
-                                         ],
-          'trim-pod' => [
-                          0,
-                          1
-                        ],
-          'closing-side-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'square-bracket-vertical-tightness' => [
-                                                   0,
-                                                   1,
-                                                   2
-                                                 ],
-          'brace-vertical-tightness' => [
-                                          0,
-                                          1,
-                                          2
-                                        ],
-          'tabs' => [
-                      0,
-                      1
-                    ],
-          'extended-line-up-parentheses' => [
-                                              0,
-                                              1
-                                            ],
-          'stack-closing-block-brace' => [
-                                           0,
-                                           1
-                                         ],
-          'stack-closing-square-bracket' => [
-                                              0,
-                                              1
-                                            ],
-          'want-left-space' => [
-                                 '+ -',
-                                 '->',
-                                 '= -> ( )',
-                                 '= .= =~ !~ :'
-                               ],
-          'minimum-space-to-comment' => [
-                                          10,
-                                          2,
-                                          4
-                                        ],
-          'add-semicolons' => [
-                                0,
-                                1
-                              ],
-          'delete-closing-side-comments' => [
-                                              0,
-                                              1
-                                            ],
-          'default-tabsize' => [
-                                 8
-                               ],
-          'space-after-keyword' => [
-                                     'push'
-                                   ],
-          'break-at-old-method-breakpoints' => [
-                                                 0,
-                                                 1
-                                               ],
-          'warning-output' => [
-                                0,
-                                1
-                              ],
-          'delete-old-newlines' => [
-                                     0,
-                                     1
-                                   ],
-          'delete-side-comments' => [
-                                      0,
-                                      1
-                                    ],
-          'blank-lines-before-closing-block' => [
-                                                  1
-                                                ],
-          'delete-pod' => [
-                            0,
-                            1
-                          ],
-          'long-block-line-count' => [
-                                       8
-                                     ],
-          'stack-opening-paren' => [
-                                     0,
-                                     1
-                                   ],
-          'keyword-paren-inner-tightness' => [
-                                               0,
-                                               1
-                                             ],
-          'standard-error-output' => [
-                                       0,
-                                       1
-                                     ],
-          'want-right-space' => [
-                                  '->',
-                                  '= -> ( )',
-                                  '= .= =~ !~ ? :',
-                                  '= / *'
-                                ],
-          'non-indenting-brace-prefix' => [
-                                            '#\\+\\+'
-                                          ],
-          'ignore-side-comment-lengths' => [
-                                             0,
-                                             1
-                                           ],
-          'break-before-paren' => [
-                                    0,
-                                    2,
-                                    3
-                                  ],
-          'valign-exclusion-list' => [
-                                       '*',
-                                       '=',
-                                       'q'
-                                     ],
-          'outdent-keyword-list' => [
-                                      'next'
-                                    ],
-          'outdent-keywords' => [
-                                  0,
-                                  1
-                                ],
-          'entab-leading-whitespace' => [
-                                          4,
-                                          8
-                                        ],
-          'square-bracket-tightness' => [
-                                          0,
-                                          1,
-                                          2
-                                        ],
-          'keyword-group-blanks-size' => [
-                                           '5'
-                                         ],
-          'keep-old-breakpoints-after' => [
-                                            '=>'
-                                          ],
-          'opening-brace-always-on-right' => [
-                                               0,
-                                               1
-                                             ],
-          'vertical-tightness-closing' => [
-                                            3
-                                          ],
-          'outdent-long-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'tight-secret-operators' => [
-                                        0,
-                                        1
-                                      ],
-          'whitespace-cycle' => [
-                                  4
-                                ],
-          'delete-repeated-commas' => [
-                                        0,
-                                        1
-                                      ],
-          'fuzzy-line-length' => [
-                                   0,
-                                   1
-                                 ],
-          'brace-left-and-indent' => [
-                                       0,
-                                       1
-                                     ],
-          'valign-block-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'brace-left-and-indent-list' => [
-                                            '*',
-                                            'if'
-                                          ],
-          'brace-tightness' => [
-                                 0,
-                                 1,
-                                 2
-                               ],
-          'line-up-parentheses-exclusion-list' => [
-                                                    '{ [ (',
-                                                    '{ [ F(2',
-                                                    '{ [ W(1'
-                                                  ],
-          'closing-side-comment-else-flag' => [
-                                                0
-                                              ],
-          'fixed-position-side-comment' => [
-                                             40
-                                           ],
-          'break-at-old-semicolon-breakpoints' => [
-                                                    0,
-                                                    1
-                                                  ],
-          'cuddled-block-list' => [
-                                    'map,sort,grep',
-                                    'sort,map,grep'
-                                  ],
-          'add-newlines' => [
-                              0,
-                              1
-                            ],
-          'maximum-line-length' => [
-                                     0,
-                                     1,
-                                     100,
-                                     100000,
-                                     120,
-                                     160,
-                                     33,
-                                     77,
-                                     78,
-                                     80
-                                   ],
-          'break-before-all-operators' => [
-                                            0,
-                                            1
-                                          ],
-          'closing-brace-indentation' => [
-                                           0,
-                                           1,
-                                           2
-                                         ],
-          'nowant-right-space' => [
-                                    '+ -',
-                                    '+ - / *',
-                                    '++ --',
-                                    '..',
-                                    '= + - / *',
-                                    'A'
-                                  ],
-          'backup-file-extension' => [
-                                       'bak',
-                                       '~'
-                                     ],
-          'keyword-group-blanks-before' => [
-                                             1,
-                                             2
-                                           ],
-          'block-brace-tightness' => [
-                                       0,
-                                       1,
-                                       2
-                                     ],
-          'maximum-file-size-mb' => [
-                                      10
-                                    ],
-          'opening-paren-right' => [
-                                     0,
-                                     1
-                                   ],
-          'ignore-old-breakpoints' => [
-                                        0,
-                                        1
-                                      ],
-          'keyword-group-blanks-delete' => [
-                                             0,
-                                             1
-                                           ],
-          'function-paren-vertical-alignment' => [
-                                                   0,
-                                                   1
-                                                 ],
-          'block-brace-vertical-tightness' => [
-                                                0,
-                                                1
-                                              ],
-          'iterations' => [
-                            1,
-                            2,
-                            4
-                          ],
-          'brace-left-exclusion-list' => [
-                                           ' '
-                                         ],
-          'backup-and-modify-in-place' => [
-                                            0,
-                                            1
-                                          ],
-          'indent-block-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'opening-square-bracket-right' => [
-                                              0,
-                                              1
-                                            ],
-          'space-function-paren' => [
-                                      0,
-                                      1
-                                    ],
-          'space-keyword-paren' => [
-                                     0,
-                                     1
-                                   ],
-          'sub-alias-list' => [
-                                'first any sum sum0 reduce',
-                                'method',
-                                'method fun'
-                              ],
-          'blank-lines-after-opening-block' => [
-                                                 2
-                                               ],
-          'valign-side-comments' => [
-                                      0,
-                                      1
-                                    ],
-          'brace-left-and-indent-exclusion-list' => [
-                                                      'eval'
-                                                    ],
-          'format-skipping-begin' => [
-                                       '#<{2,}'
-                                     ],
-          'maximum-consecutive-blank-lines' => [
-                                                 0,
-                                                 1,
-                                                 2
-                                               ],
-          'logical-padding' => [
-                                 0,
-                                 1
-                               ],
-          'blank-lines-after-opening-block-list' => [
-                                                      '*'
-                                                    ],
-          'short-concatenation-item-length' => [
-                                                 12,
-                                                 8
-                                               ],
-          'paren-vertical-tightness-closing' => [
-                                                  0,
-                                                  1,
-                                                  2
-                                                ],
-          'line-up-parentheses-inclusion-list' => [
-                                                    'f(2'
-                                                  ],
-          'backup-method' => [
-                               'copy'
-                             ],
-          'space-terminal-semicolon' => [
-                                          0,
-                                          1
-                                        ],
-          'want-break-before' => [
-                                   ' ',
-                                   '% + - * / x != == >= <= =~ !~ < > | & = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=',
-                                   '% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=',
-                                   '='
-                                 ],
-          'variable-maximum-line-length' => [
-                                              0,
-                                              1
-                                            ],
-          'keyword-group-blanks-repeat-count' => [
-                                                   0
-                                                 ],
-          'break-at-old-attribute-breakpoints' => [
-                                                    0,
-                                                    1
-                                                  ],
-          'one-line-block-nesting' => [
-                                        0,
-                                        1
-                                      ],
-          'break-at-old-keyword-breakpoints' => [
-                                                  0,
-                                                  1
-                                                ],
-          'cuddled-break-option' => [
-                                      1
-                                    ],
-          'break-before-square-bracket' => [
-                                             0
-                                           ],
-          'paren-vertical-tightness' => [
-                                          0,
-                                          1,
-                                          2
-                                        ],
-          'keyword-group-blanks-after' => [
-                                            1,
-                                            2
-                                          ],
-          'starting-indentation-level' => [
-                                            0
-                                          ],
-          'space-prototype-paren' => [
-                                       0,
-                                       1,
-                                       2
-                                     ],
-          'line-up-parentheses' => [
-                                     0,
-                                     1
-                                   ],
-          'closing-side-comments-balanced' => [
-                                                0,
-                                                1
-                                              ],
-          'opening-hash-brace-right' => [
-                                          0,
-                                          1
-                                        ],
-          'stack-opening-square-bracket' => [
-                                              0,
-                                              1
-                                            ],
-          'grep-alias-list' => [
-                                 'Grep Map'
-                               ],
-          'break-before-hash-brace-and-indent' => [
-                                                    0,
-                                                    1,
-                                                    2
-                                                  ],
-          'nospace-after-keyword' => [
-                                       'my for'
-                                     ],
-          'format-skipping' => [
-                                 0,
-                                 1
-                               ],
-          'weld-nested-containers' => [
-                                        0,
-                                        1
-                                      ],
-          'outdent-long-quotes' => [
-                                     0,
-                                     1
-                                   ],
-          'keep-interior-semicolons' => [
-                                          0,
-                                          1
-                                        ],
-          'paren-tightness' => [
-                                 0,
-                                 1,
-                                 2
-                               ],
-          'format' => [
-                        'html',
-                        'tidy'
-                      ],
-          'space-for-semicolon' => [
-                                     0,
-                                     1
-                                   ],
-          'delete-block-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'brace-vertical-tightness-closing' => [
-                                                  0,
-                                                  1,
-                                                  2
-                                                ],
-          'static-side-comments' => [
-                                      0,
-                                      1
-                                    ],
-          'valign-inclusion-list' => [
-                                       '='
-                                     ],
-          'keep-old-breakpoints-before' => [
-                                             '=> ,'
-                                           ],
-          'quiet' => [
-                       0,
-                       1
-                     ],
-          'break-before-paren-and-indent' => [
-                                               0,
-                                               1,
-                                               2
-                                             ],
-          'keyword-group-blanks-inside' => [
-                                             0,
-                                             1
-                                           ],
-          'break-before-square-bracket-and-indent' => [
-                                                        0
-                                                      ],
-          'blanks-before-blocks' => [
-                                      0,
-                                      1
-                                    ],
-          'closing-side-comment-maximum-text' => [
-                                                   20,
-                                                   40
-                                                 ],
-          'add-whitespace' => [
-                                0,
-                                1
-                              ],
-          'break-at-old-comma-breakpoints' => [
-                                                0,
-                                                1
-                                              ],
-          'keep-old-blank-lines' => [
-                                      0,
-                                      1,
-                                      2
-                                    ],
-          'stack-closing-hash-brace' => [
-                                          0,
-                                          1
-                                        ],
-          'closing-side-comment-list' => [
-                                           'sub'
-                                         ],
-          'indent-columns' => [
-                                0,
-                                2,
-                                4
-                              ],
-          'indent-spaced-block-comments' => [
-                                              0,
-                                              1
-                                            ],
-          'outdent-static-block-comments' => [
-                                               0,
-                                               1
-                                             ],
-          'weld-nested-exclusion-list' => [
-                                            '.K{',
-                                            '.K{ ^{ [',
-                                            '^K( [ { q',
-                                            '^['
-                                          ],
-          'static-block-comment-prefix' => [
-                                             '#x#'
-                                           ],
-          'static-block-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'extended-continuation-indentation' => [
-                                                   0,
-                                                   1
-                                                 ],
-          'comma-arrow-breakpoints' => [
-                                         1,
-                                         5
-                                       ],
-          'square-bracket-vertical-tightness-closing' => [
-                                                           0,
-                                                           1,
-                                                           2
-                                                         ],
-          'non-indenting-braces' => [
-                                      0,
-                                      1
-                                    ],
-          'break-after-all-operators' => [
-                                           0,
-                                           1
-                                         ],
-          'maximum-level-errors' => [
-                                      1
-                                    ],
-          'hanging-side-comments' => [
-                                       0,
-                                       1
-                                     ],
-          'blank-lines-before-packages' => [
-                                             0,
-                                             1
-                                           ],
-          'indent-closing-brace' => [
-                                      0,
-                                      1
-                                    ],
-          'perl-syntax-check-flags' => [
-                                         '-c -T'
-                                       ],
-          'brace-left-list' => [
-                                 'sub do asub'
-                               ],
-          'continuation-indentation' => [
-                                          0,
-                                          2,
-                                          4
-                                        ],
-          'blanks-before-comments' => [
-                                        0,
-                                        1
-                                      ],
-          'want-break-after' => [
-                                  '% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x= . << >> -> && ||'
-                                ],
-          'blank-lines-before-closing-block-list' => [
-                                                       '*'
-                                                     ],
-          'character-encoding' => [
-                                    'guess'
-                                  ],
-          'opening-anonymous-sub-brace-on-new-line' => [
-                                                         0,
-                                                         1
-                                                       ],
-          'cuddled-else' => [
-                              0,
-                              1
-                            ]
-        };
index 5d5e89ff772c0c69d4e03030beb027245e580922..0b75264a2946c5f7114e3de117d8414600c22f98 100644 (file)
@@ -1,5 +1,5 @@
     if    ( $level == 3 ) { $val = $global{'section'} }
     elsif ( $level == 2 ) { $val = $global{'chapter'} }
     else {
-        ##FIXME - added with perltidy -ame
+        #NEED COMMENT
     }
diff --git a/t/snippets/expect/vsn.vsn3 b/t/snippets/expect/vsn.vsn3
new file mode 100644 (file)
index 0000000..d2f785c
--- /dev/null
@@ -0,0 +1,12 @@
+@data = (
+    [ "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th" ],
+    [ 1,     2,     5,     6,     3,     1.5,   -1,    -3,    -4 ],
+    [ -4,    -3,    1,     1,     -3,    -1.5,  -2,    -1,    0 ],
+    [ 9,     8,     9,     8.4,   7.1,   7.5,   8,     3,     -3 ],
+    [ 0.1,   0.2,   0.5,   0.4,   0.3,   0.5,   0.1,   0,     0.4 ],
+);
+
+$s->drawLine( 35,  0 );
+$s->drawLine( 0,   10 );
+$s->drawLine( -35, 0 );
+$s->drawLine( 0,   -10 );
index f8af3100fcb9f149996a68b0e71ad8c642c31015..c51a0d7b77eb5a3837d236b23da3a325dd13bbfd 100644 (file)
 ../snippets29.t        c353.def
 ../snippets29.t        git137.def
 ../snippets29.t        git137.git137
+../snippets29.t        git138.def
+../snippets29.t        git138.git138
 ../snippets3.t ce_wn1.ce_wn
 ../snippets3.t ce_wn1.def
 ../snippets3.t colin.colin
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
-../snippets29.t        git138.def
-../snippets29.t        git138.git138
+../snippets29.t        vsn.vsn3
diff --git a/t/snippets/vsn3.par b/t/snippets/vsn3.par
new file mode 100644 (file)
index 0000000..50f52b2
--- /dev/null
@@ -0,0 +1,2 @@
+# turn off vsn
+-nvsn
index f9873fac95752b54c42c900bea46304df1da2d0a..415b838389c69f4be8ce963d9d21656ccc75c7fd 100644 (file)
@@ -37,7 +37,10 @@ BEGIN {
     # BEGIN SECTION 1: Parameter combinations #
     ###########################################
     $rparams = {
-        'ame'    => "--add-missing-else",
+        'ame' => <<'----------',
+--add-missing-else
+--add-missing-else-comment="NEED COMMENT"
+----------
         'c269'   => "-ame",
         'def'    => "",
         'git116' => "-viu",
@@ -387,7 +390,7 @@ sub hello {
     if    ( $level == 3 ) { $val = $global{'section'} }
     elsif ( $level == 2 ) { $val = $global{'chapter'} }
     else {
-        ##FIXME - added with perltidy -ame
+        #NEED COMMENT
     }
 #14...........
         },
index 120b74db74ea1f4e5f6f2f9cef2d1d704353519f..995ceca6f067ca1751ca184f13a2e8fedbc0bbee 100644 (file)
@@ -19,6 +19,7 @@
 #16 git137.git137
 #17 git138.def
 #18 git138.git138
+#19 vsn.vsn3
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -62,6 +63,10 @@ BEGIN {
 # turn off vsn with -vsnl
 -vsn
 -vsnl=0
+----------
+        'vsn3' => <<'----------',
+# turn off vsn
+-nvsn
 ----------
     };
 
@@ -659,6 +664,25 @@ $VAR1 = [ 'method',
 ];
 #18...........
         },
+
+        'vsn.vsn3' => {
+            source => "vsn",
+            params => "vsn3",
+            expect => <<'#19...........',
+@data = (
+    [ "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th" ],
+    [ 1,     2,     5,     6,     3,     1.5,   -1,    -3,    -4 ],
+    [ -4,    -3,    1,     1,     -3,    -1.5,  -2,    -1,    0 ],
+    [ 9,     8,     9,     8.4,   7.1,   7.5,   8,     3,     -3 ],
+    [ 0.1,   0.2,   0.5,   0.4,   0.3,   0.5,   0.1,   0,     0.4 ],
+);
+
+$s->drawLine( 35,  0 );
+$s->drawLine( 0,   10 );
+$s->drawLine( -35, 0 );
+$s->drawLine( 0,   -10 );
+#19...........
+        },
     };
 
     my $ntests = 0 + keys %{$rtests};