From: Steve Hancock Date: Thu, 2 May 2024 00:50:41 +0000 (-0700) Subject: add test case X-Git-Tag: 20240511~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8f6167657e99c3f0af11e01f7e1c082290763f28;p=perltidy.git add test case --- diff --git a/.gitignore b/.gitignore index 7b07514a..23ee0c22 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ perltidy-*.pl perltidy.pl pm_to_blib tmp*/ +t/snippets/coverage_values.txt diff --git a/t/snippets/ame.par b/t/snippets/ame.par index 51c5b085..9559c04a 100644 --- a/t/snippets/ame.par +++ b/t/snippets/ame.par @@ -1 +1,2 @@ --add-missing-else +--add-missing-else-comment="NEED COMMENT" diff --git a/t/snippets/coverage_missing.txt b/t/snippets/coverage_missing.txt index b747cbec..04eabd7d 100644 --- a/t/snippets/coverage_missing.txt +++ b/t/snippets/coverage_missing.txt @@ -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 index e4d7c33c..00000000 --- a/t/snippets/coverage_values.txt +++ /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 - ] - }; diff --git a/t/snippets/expect/ame.ame b/t/snippets/expect/ame.ame index 5d5e89ff..0b75264a 100644 --- a/t/snippets/expect/ame.ame +++ b/t/snippets/expect/ame.ame @@ -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 index 00000000..d2f785c3 --- /dev/null +++ b/t/snippets/expect/vsn.vsn3 @@ -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 ); diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index f8af3100..c51a0d7b 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -419,6 +419,8 @@ ../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 @@ -559,5 +561,4 @@ ../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 index 00000000..50f52b28 --- /dev/null +++ b/t/snippets/vsn3.par @@ -0,0 +1,2 @@ +# turn off vsn +-nvsn diff --git a/t/snippets28.t b/t/snippets28.t index f9873fac..415b8383 100644 --- a/t/snippets28.t +++ b/t/snippets28.t @@ -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........... }, diff --git a/t/snippets29.t b/t/snippets29.t index 120b74db..995ceca6 100644 --- a/t/snippets29.t +++ b/t/snippets29.t @@ -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};