From: Steve Hancock Date: Thu, 23 Apr 2020 13:59:40 +0000 (-0700) Subject: added numerous test cases X-Git-Tag: 20200619~77 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f87e7bb32244dc0e4ab44092d779434731599550;p=perltidy.git added numerous test cases --- diff --git a/t/snippets/braces3.par b/t/snippets/braces3.par index 3ee06bc1..aa7373de 100644 --- a/t/snippets/braces3.par +++ b/t/snippets/braces3.par @@ -1 +1 @@ --bli +-bli -bbvt=1 diff --git a/t/snippets/braces4.par b/t/snippets/braces4.par new file mode 100644 index 00000000..d0f21a53 --- /dev/null +++ b/t/snippets/braces4.par @@ -0,0 +1 @@ +-icb diff --git a/t/snippets/braces5.par b/t/snippets/braces5.par new file mode 100644 index 00000000..fcd131ba --- /dev/null +++ b/t/snippets/braces5.par @@ -0,0 +1 @@ +-bli -blil='if' diff --git a/t/snippets/braces6.par b/t/snippets/braces6.par new file mode 100644 index 00000000..08942cc2 --- /dev/null +++ b/t/snippets/braces6.par @@ -0,0 +1 @@ +-ce diff --git a/t/snippets/coverage_missing.txt b/t/snippets/coverage_missing.txt index a53b83fb..7b344de3 100644 --- a/t/snippets/coverage_missing.txt +++ b/t/snippets/coverage_missing.txt @@ -4,7 +4,6 @@ assert-tidy assert-untidy backlink block-brace-vertical-tightness-list -brace-left-and-indent-list break-at-old-attribute-breakpoints break-at-old-keyword-breakpoints break-at-old-logical-breakpoints @@ -13,7 +12,6 @@ cachedir closing-side-comment-list closing-side-comment-prefix closing-side-comment-warnings -closing-side-comments-balanced closing-token-indentation cuddled-block-list-exclusive dump-cuddled-block-list @@ -97,7 +95,6 @@ html-src-extension html-table-of-contents html-toc-extension htmlroot -indent-closing-brace keyword-group-blanks-list libpods logfile @@ -130,10 +127,6 @@ preserve-line-endings profile quiet show-options -space-after-keyword -space-function-paren -space-keyword-paren -stack-closing-block-brace stack-opening-block-brace standard-output static-block-comment-prefix diff --git a/t/snippets/coverage_values.txt b/t/snippets/coverage_values.txt index b44d86ee..b907f75c 100644 --- a/t/snippets/coverage_values.txt +++ b/t/snippets/coverage_values.txt @@ -1,79 +1,169 @@ $VAR1 = { - 'space-terminal-semicolon' => [ - 0, - 1 - ], - 'format' => [ - 'html', - 'tidy' - ], + 'line-up-parentheses' => [ + 0, + 1 + ], + 'nowant-left-space' => [ + '++ -- ?', + '..', + '= + - / *' + ], + 'backup-file-extension' => [ + 'bak', + '~' + ], + 'closing-side-comments-balanced' => [ + 0, + 1 + ], + 'break-after-all-operators' => [ + 0, + 1 + ], 'want-break-before' => [ ' ', '% + - * / x != == >= <= =~ !~ < > | & = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=', '% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=', '=' ], - 'cuddled-break-option' => [ + 'one-line-block-nesting' => [ + 0, + 1 + ], + 'fixed-position-side-comment' => [ + 40 + ], + 'delete-closing-side-comments' => [ + 0, + 1 + ], + 'closing-side-comments' => [ + 0, + 1 + ], + 'break-before-all-operators' => [ + 0, + 1 + ], + 'blanks-before-blocks' => [ + 0, 1 ], - 'keep-interior-semicolons' => [ - 0, - 1 - ], - 'paren-vertical-tightness' => [ - 0, - 1, - 2 - ], + 'space-prototype-paren' => [ + 0, + 1, + 2 + ], + 'opening-sub-brace-on-new-line' => [ + 0, + 1 + ], 'closing-paren-indentation' => [ 0, 1, 2 ], + 'square-bracket-vertical-tightness-closing' => [ + 0, + 2 + ], + 'indent-spaced-block-comments' => [ + 0, + 1 + ], 'want-right-space' => [ '= .= =~ !~ ? :' ], - 'stack-closing-hash-brace' => [ - 0, - 1 - ], - 'closing-brace-indentation' => [ + 'timestamp' => [ + 0, + 1 + ], + 'blank-lines-before-packages' => [ + 0, + 1 + ], + 'closing-side-comment-maximum-text' => [ + 20, + 40 + ], + 'stack-closing-block-brace' => [ + 0, + 1 + ], + 'one-line-block-semicolons' => [ 0, 1, 2 ], - 'block-brace-vertical-tightness' => [ - 0 - ], - 'brace-vertical-tightness-closing' => [ - 0, - 2 - ], - 'stack-opening-paren' => [ - 0, - 1 + 'break-at-old-method-breakpoints' => [ + 0, + 1 + ], + 'entab-leading-whitespace' => [ + 8 + ], + 'space-backslash-quote' => [ + 0, + 1, + 2 + ], + 'static-block-comments' => [ + 0, + 1 + ], + 'space-after-keyword' => [ + 'push' ], - 'add-whitespace' => [ - 0, - 1 - ], - 'delete-semicolons' => [ - 0, - 1 - ], - 'break-at-old-semicolon-breakpoints' => [ + 'nowant-right-space' => [ + '++ --', + '..', + '= + - / *', + 'A' + ], + 'nospace-after-keyword' => [ + 'my for' + ], + 'closing-square-bracket-indentation' => [ 0, - 1 + 1, + 2 ], - 'continuation-indentation' => [ - 0, - 2, - 4 - ], + 'long-block-line-count' => [ + 8 + ], + 'iterations' => [ + 1 + ], + 'blank-lines-before-closing-block' => [ + 1 + ], + 'format' => [ + 'html', + 'tidy' + ], 'brace-left-and-indent' => [ 0, 1 ], + 'opening-brace-on-new-line' => [ + 0, + 1 + ], + 'outdent-keywords' => [ + 0, + 1 + ], + 'break-at-old-semicolon-breakpoints' => [ + 0, + 1 + ], + 'space-keyword-paren' => [ + 0, + 1 + ], + 'default-tabsize' => [ + 8 + ], 'square-bracket-vertical-tightness' => [ 0, 1, @@ -82,262 +172,277 @@ $VAR1 = { 'closing-side-comment-else-flag' => [ 0 ], - 'short-concatenation-item-length' => [ - 12, - 8 - ], - 'break-before-all-operators' => [ - 0, - 1 - ], - 'delete-block-comments' => [ - 0, - 1 - ], - 'starting-indentation-level' => [ - 0 - ], - 'closing-side-comments' => [ - 0, - 1 - ], - 'opening-paren-right' => [ + 'outdent-static-block-comments' => [ + 0, + 1 + ], + 'stack-closing-square-bracket' => [ + 0, + 1 + ], + 'delete-pod' => [ + 0, + 1 + ], + 'opening-hash-brace-right' => [ + 0, + 1 + ], + 'closing-side-comment-interval' => [ + 2, + 20, + 6 + ], + 'delete-old-newlines' => [ 0, 1 ], - 'blanks-before-comments' => [ - 0, - 1 - ], - 'minimum-space-to-comment' => [ - 10, - 2, - 4 - ], - 'square-bracket-vertical-tightness-closing' => [ - 0, - 2 - ], - 'indent-block-comments' => [ + 'delete-block-comments' => [ 0, 1 ], - 'break-at-old-method-breakpoints' => [ - 0, - 1 - ], + 'keyword-group-blanks-size' => [ + '5' + ], + 'outdent-labels' => [ + 0, + 1 + ], + 'keyword-group-blanks-delete' => [ + 0, + 1 + ], 'keep-old-blank-lines' => [ 0, 1, 2 ], - 'space-prototype-paren' => [ - 0, - 1, - 2 + 'brace-tightness' => [ + 0, + 1, + 2 + ], + 'cuddled-else' => [ + 0, + 1 + ], + 'hanging-side-comments' => [ + 0, + 1 ], - 'stack-opening-hash-brace' => [ + 'blank-lines-after-opening-block-list' => [ + '*' + ], + 'sub-alias-list' => [ + 'method fun' + ], + 'comma-arrow-breakpoints' => [ + 1, + 5 + ], + 'cuddled-break-option' => [ + 1 + ], + 'continuation-indentation' => [ 0, - 1 + 2, + 4 ], - 'keyword-group-blanks-inside' => [ - 0, - 1 - ], - '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' => [ + 'brace-vertical-tightness-closing' => [ + 0, + 2 + ], + 'want-break-after' => [ + '% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x= . << >> -> && ||' + ], + 'backup-and-modify-in-place' => [ + 0, + 1 + ], + 'add-semicolons' => [ 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' => [ + 'keyword-group-blanks-before' => [ + 1, + 2 + ], + 'standard-error-output' => [ + 0, + 1 + ], + 'opening-square-bracket-right' => [ 0, 1 ], - 'blank-lines-before-closing-block' => [ - 1 - ], - 'cuddled-else' => [ - 0, - 1 - ], - 'outdent-long-quotes' => [ + 'add-whitespace' => [ + 0, + 1 + ], + 'stack-opening-paren' => [ 0, 1 ], - 'paren-vertical-tightness-closing' => [ - 0, - 2 - ], - 'iterations' => [ - 1 - ], - 'delete-pod' => [ - 0, - 1 - ], - 'standard-error-output' => [ + 'delete-side-comments' => [ + 0, + 1 + ], + 'keyword-group-blanks-inside' => [ + 0, + 1 + ], + 'warning-output' => [ + 0, + 1 + ], + 'want-left-space' => [ + '= .= =~ !~ :' + ], + 'maximum-fields-per-table' => [ + 0 + ], + 'indent-block-comments' => [ 0, 1 ], + 'weld-nested-containers' => [ + 0, + 1 + ], + 'block-brace-vertical-tightness' => [ + 0, + 1 + ], + 'static-side-comments' => [ + 0, + 1 + ], + 'ignore-old-breakpoints' => [ + 0, + 1 + ], + 'short-concatenation-item-length' => [ + 12, + 8 + ], 'space-for-semicolon' => [ 0, 1 ], - 'warning-output' => [ - 0, - 1 - ], - 'one-line-block-semicolons' => [ + 'closing-brace-indentation' => [ 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 - ], + 'blank-lines-after-opening-block' => [ + 2 + ], 'opening-brace-always-on-right' => [ 0, 1 ], - 'delete-side-comments' => [ - 0, - 1 - ], - 'paren-tightness' => [ - 0, - 1, - 2 - ], - 'static-side-comments' => [ - 0, - 1 - ], - 'blank-lines-before-packages' => [ - 0, - 1 - ], + 'recombine' => [ + 0, + 1 + ], 'indent-columns' => [ 0, 2, 4 ], + 'opening-paren-right' => [ + 0, + 1 + ], + 'stack-closing-paren' => [ + 0, + 1 + ], + 'paren-tightness' => [ + 0, + 1, + 2 + ], + 'variable-maximum-line-length' => [ + 0, + 1 + ], + 'brace-vertical-tightness' => [ + 0, + 1, + 2 + ], + 'break-at-old-comma-breakpoints' => [ + 0, + 1 + ], + 'character-encoding' => [ + 'guess' + ], 'fuzzy-line-length' => [ 0, 1 ], - 'blank-lines-after-opening-block-list' => [ - '*' - ], - 'entab-leading-whitespace' => [ - 8 - ], - 'add-newlines' => [ + 'blank-lines-before-closing-block-list' => [ + '*' + ], + 'check-syntax' => [ 0, 1 ], - 'hanging-side-comments' => [ + 'stack-closing-hash-brace' => [ + 0, + 1 + ], + 'cuddled-block-list' => [ + 'map,sort,grep', + 'sort,map,grep' + ], + 'square-bracket-tightness' => [ + 0, + 1, + 2 + ], + 'block-brace-tightness' => [ 0, - 1 + 1, + 2 ], - 'stack-closing-square-bracket' => [ - 0, - 1 - ], - 'fixed-position-side-comment' => [ - 40 + 'add-newlines' => [ + 0, + 1 + ], + 'space-terminal-semicolon' => [ + 0, + 1 + ], + 'ignore-side-comment-lengths' => [ + 0, + 1 ], - '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' => [ + 'brace-left-and-indent-list' => [ + 'if' + ], + 'tight-secret-operators' => [ 0, 1 ], - 'maximum-fields-per-table' => [ - 0 + 'space-function-paren' => [ + 0, + 1 + ], + 'keyword-group-blanks-after' => [ + 1, + 2 + ], + 'stack-opening-hash-brace' => [ + 0, + 1 ], - 'default-tabsize' => [ - 8 - ], - 'backup-and-modify-in-place' => [ - 0, - 1 + 'starting-indentation-level' => [ + 0 ], - 'closing-square-bracket-indentation' => [ - 0, - 1, - 2 - ], - 'character-encoding' => [ - 'guess' - ], - 'static-block-comments' => [ + 'delete-old-whitespace' => [ 0, 1 ], @@ -346,106 +451,38 @@ $VAR1 = { 1, 2 ], - 'break-after-all-operators' => [ - 0, - 1 - ], - 'space-backslash-quote' => [ - 0, - 1, - 2 - ], - 'indent-spaced-block-comments' => [ - 0, - 1 - ], - '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 - ], - 'keyword-group-blanks-size' => [ - '5' - ], - 'brace-tightness' => [ - 0, - 1, - 2 - ], - 'outdent-keywords' => [ - 0, - 1 - ], - 'nowant-left-space' => [ - '++ -- ?', - '..', - '= + - / *' - ], - 'opening-anonymous-sub-brace-on-new-line' => [ - 0, - 1 - ], - 'stack-closing-paren' => [ + 'outdent-long-quotes' => [ 0, 1 ], - 'tight-secret-operators' => [ + 'blanks-before-comments' => [ 0, 1 ], - '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' => [ + 'outdent-long-comments' => [ 0, 1 ], - 'cuddled-block-list' => [ - 'map,sort,grep', - 'sort,map,grep' - ], - 'closing-side-comment-interval' => [ - 2, - 20, - 6 - ], + 'paren-vertical-tightness' => [ + 0, + 1, + 2 + ], + 'opening-anonymous-sub-brace-on-new-line' => [ + 0, + 1 + ], + 'keyword-group-blanks-repeat-count' => [ + 0 + ], + 'delete-semicolons' => [ + 0, + 1 + ], + 'paren-vertical-tightness-closing' => [ + 0, + 2 + ], 'maximum-line-length' => [ 0, 1, @@ -456,38 +493,28 @@ $VAR1 = { 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 - ] + 'perl-syntax-check-flags' => [ + '-c -T' + ], + 'indent-closing-brace' => [ + 0, + 1 + ], + 'keep-interior-semicolons' => [ + 0, + 1 + ], + 'minimum-space-to-comment' => [ + 10, + 2, + 4 + ], + 'blank-lines-before-subs' => [ + 0, + 1 + ], + 'stack-opening-square-bracket' => [ + 0, + 1 + ] }; diff --git a/t/snippets/csc1.par b/t/snippets/csc1.par index f0f1921d..19840cab 100644 --- a/t/snippets/csc1.par +++ b/t/snippets/csc1.par @@ -1 +1 @@ --csc -csci=2 -cscb +-csc -csci=2 -ncscb diff --git a/t/snippets/expect/braces.braces3 b/t/snippets/expect/braces.braces3 index bbce26ff..7e2286d5 100644 --- a/t/snippets/expect/braces.braces3 +++ b/t/snippets/expect/braces.braces3 @@ -1,12 +1,9 @@ sub message - { - if ( !defined( $_[0] ) ) - { - print("Hello, World\n"); + { if ( !defined( $_[0] ) ) + { print("Hello, World\n"); } else - { - print( $_[0], "\n" ); + { print( $_[0], "\n" ); } } diff --git a/t/snippets/expect/braces.braces4 b/t/snippets/expect/braces.braces4 new file mode 100644 index 00000000..d6e3cb28 --- /dev/null +++ b/t/snippets/expect/braces.braces4 @@ -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/expect/braces.braces5 b/t/snippets/expect/braces.braces5 new file mode 100644 index 00000000..a384e8c1 --- /dev/null +++ b/t/snippets/expect/braces.braces5 @@ -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.braces6 b/t/snippets/expect/braces.braces6 new file mode 100644 index 00000000..f4876819 --- /dev/null +++ b/t/snippets/expect/braces.braces6 @@ -0,0 +1,11 @@ +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/csc.csc1 b/t/snippets/expect/csc.csc1 index e99b0394..6a0fe7b7 100644 --- a/t/snippets/expect/csc.csc1 +++ b/t/snippets/expect/csc.csc1 @@ -4,5 +4,5 @@ } ## end if ( !defined( $_[0] )) else { print( $_[0], "\n" ); - } ## end else [ if ( !defined( $_[0] ))] + } ## end else [ if ( !defined( $_[0] )) } ## end sub message diff --git a/t/snippets/expect/scbb.def b/t/snippets/expect/scbb.def new file mode 100644 index 00000000..9aa18610 --- /dev/null +++ b/t/snippets/expect/scbb.def @@ -0,0 +1,11 @@ + # test -scbb: + for $w1 (@w1) { + for $w2 (@w2) { + for $w3 (@w3) { + for $w4 (@w4) { + push( @lines, "$w1 $w2 $w3 $w4\n" ); + } + } + } + } + diff --git a/t/snippets/expect/scbb.scbb b/t/snippets/expect/scbb.scbb new file mode 100644 index 00000000..41b7c795 --- /dev/null +++ b/t/snippets/expect/scbb.scbb @@ -0,0 +1,8 @@ + # test -scbb: + for $w1 (@w1) { + for $w2 (@w2) { + for $w3 (@w3) { + for $w4 (@w4) { + push( @lines, "$w1 $w2 $w3 $w4\n" ); + } } } } + diff --git a/t/snippets/expect/space_paren.def b/t/snippets/expect/space_paren.def new file mode 100644 index 00000000..a7083ffb --- /dev/null +++ b/t/snippets/expect/space_paren.def @@ -0,0 +1,4 @@ +myfunc( $a, $b, $c ); # test -sfp +push( @array, $val ); # test -skp and also -sak='push' +split( /\|/, $txt ); # test -skp and also -sak='push' +my ( $v1, $v2 ) = @_; # test -sak='push' diff --git a/t/snippets/expect/space_paren.space_paren1 b/t/snippets/expect/space_paren.space_paren1 new file mode 100644 index 00000000..371dcba4 --- /dev/null +++ b/t/snippets/expect/space_paren.space_paren1 @@ -0,0 +1,4 @@ +myfunc ( $a, $b, $c ); # test -sfp +push ( @array, $val ); # test -skp and also -sak='push' +split ( /\|/, $txt ); # test -skp and also -sak='push' +my ( $v1, $v2 ) = @_; # test -sak='push' diff --git a/t/snippets/expect/space_paren.space_paren2 b/t/snippets/expect/space_paren.space_paren2 new file mode 100644 index 00000000..052af7c4 --- /dev/null +++ b/t/snippets/expect/space_paren.space_paren2 @@ -0,0 +1,4 @@ +myfunc( $a, $b, $c ); # test -sfp +push ( @array, $val ); # test -skp and also -sak='push' +split( /\|/, $txt ); # test -skp and also -sak='push' +my ( $v1, $v2 ) = @_; # test -sak='push' diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index 87fc4ae7..d430b89b 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -178,6 +178,38 @@ ../snippets18.t wn8.def ../snippets18.t wn8.wn ../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 +../snippets19.t braces.braces4 +../snippets19.t scbb.def +../snippets19.t scbb.scbb +../snippets19.t space_paren.def +../snippets19.t space_paren.space_paren1 +../snippets19.t space_paren.space_paren2 +../snippets19.t braces.braces5 ../snippets2.t angle.def ../snippets2.t arrows1.def ../snippets2.t arrows2.def @@ -338,28 +370,4 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def -../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 +../snippets19.t braces.braces6 diff --git a/t/snippets/scbb.in b/t/snippets/scbb.in new file mode 100644 index 00000000..9aa18610 --- /dev/null +++ b/t/snippets/scbb.in @@ -0,0 +1,11 @@ + # test -scbb: + for $w1 (@w1) { + for $w2 (@w2) { + for $w3 (@w3) { + for $w4 (@w4) { + push( @lines, "$w1 $w2 $w3 $w4\n" ); + } + } + } + } + diff --git a/t/snippets/scbb.par b/t/snippets/scbb.par new file mode 100644 index 00000000..02b81265 --- /dev/null +++ b/t/snippets/scbb.par @@ -0,0 +1 @@ +-scbb diff --git a/t/snippets/space_paren.in b/t/snippets/space_paren.in new file mode 100644 index 00000000..c807602b --- /dev/null +++ b/t/snippets/space_paren.in @@ -0,0 +1,4 @@ +myfunc ( $a, $b, $c ); # test -sfp +push ( @array, $val ); # test -skp and also -sak='push' +split( /\|/, $txt ); # test -skp and also -sak='push' +my ( $v1, $v2 ) = @_; # test -sak='push' diff --git a/t/snippets/space_paren1.par b/t/snippets/space_paren1.par new file mode 100644 index 00000000..8fd2416a --- /dev/null +++ b/t/snippets/space_paren1.par @@ -0,0 +1 @@ +-sfp -skp diff --git a/t/snippets/space_paren2.par b/t/snippets/space_paren2.par new file mode 100644 index 00000000..0f242248 --- /dev/null +++ b/t/snippets/space_paren2.par @@ -0,0 +1 @@ +-sak=push diff --git a/t/snippets18.t b/t/snippets18.t index 89f78edf..6a4e28ca 100644 --- a/t/snippets18.t +++ b/t/snippets18.t @@ -39,9 +39,9 @@ BEGIN { $rparams = { 'braces1' => "-bl -asbl", 'braces2' => "-sbl", - 'braces3' => "-bli", + 'braces3' => "-bli -bbvt=1", 'comments5' => "-dsc -nsbc", - 'csc1' => "-csc -csci=2 -cscb", + 'csc1' => "-csc -csci=2 -ncscb", 'csc2' => "-dcsc", 'def' => "", 'iob' => "-iob", @@ -430,14 +430,11 @@ $myfun = sub { params => "braces3", expect => <<'#7...........', sub message - { - if ( !defined( $_[0] ) ) - { - print("Hello, World\n"); + { if ( !defined( $_[0] ) ) + { print("Hello, World\n"); } else - { - print( $_[0], "\n" ); + { print( $_[0], "\n" ); } } @@ -476,7 +473,7 @@ $myfun = sub { } ## end if ( !defined( $_[0] )) else { print( $_[0], "\n" ); - } ## end else [ if ( !defined( $_[0] ))] + } ## end else [ if ( !defined( $_[0] )) } ## end sub message #9........... }, diff --git a/t/snippets19.t b/t/snippets19.t index 38f229a5..ff871345 100644 --- a/t/snippets19.t +++ b/t/snippets19.t @@ -11,6 +11,14 @@ #8 tightness.tightness1 #9 tightness.tightness2 #10 tightness.tightness3 +#11 braces.braces4 +#12 scbb.def +#13 scbb.scbb +#14 space_paren.def +#15 space_paren.space_paren1 +#16 space_paren.space_paren2 +#17 braces.braces5 +#18 braces.braces6 # To locate test #13 you can search for its name or the string '#13' @@ -28,15 +36,23 @@ BEGIN { # BEGIN SECTION 1: Parameter combinations # ########################################### $rparams = { + 'braces4' => "-icb", + 'braces5' => <<'----------', +-bli -blil='if' +---------- + 'braces6' => "-ce", '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' => <<'----------', + 'outdent1' => "-nola -okw", + 'sbq0' => "-sbq=0", + 'sbq2' => "-sbq=2", + 'scbb' => "-scbb", + 'space_paren1' => "-sfp -skp", + 'space_paren2' => "-sak=push", + 'tightness1' => "-pt=0 -sbt=0 -bt=0 -bbt=0", + 'tightness2' => <<'----------', -pt=1 -sbt=1 -bt=1 -bbt=1 ---------- @@ -51,6 +67,21 @@ BEGIN { ############################ $rsources = { + 'braces' => <<'----------', +sub message { + if ( !defined( $_[0] ) ) { + print("Hello, World\n"); + } + else { + print( $_[0], "\n" ); + } +} + +$myfun = sub { + print("Hello, World\n"); +}; +---------- + 'misc_tests' => <<'----------', for ( @a = @$ap, $u = shift @a; @a; $u = $v ) { ... } # test -sfs $i = 1 ; # test -sts @@ -75,6 +106,27 @@ my ( $a, $b, $c ) = @_; # test -nsak="my for" $str2=\ 'string2'; ---------- + 'scbb' => <<'----------', + # test -scbb: + for $w1 (@w1) { + for $w2 (@w2) { + for $w3 (@w3) { + for $w4 (@w4) { + push( @lines, "$w1 $w2 $w3 $w4\n" ); + } + } + } + } + +---------- + + 'space_paren' => <<'----------', +myfunc ( $a, $b, $c ); # test -sfp +push ( @array, $val ); # test -skp and also -sak='push' +split( /\|/, $txt ); # test -skp and also -sak='push' +my ( $v1, $v2 ) = @_; # test -sak='push' +---------- + 'tightness' => <<'----------', if (( my $len_tab = length( $tabstr ) ) > 0) { } # test -pt $width = $col[ $j + $k ] - $col[ $j ]; # test -sbt @@ -203,6 +255,131 @@ $obj->{$parsed_sql->{'table'}[0]}; # test -bt %bf = map {$_ => -M $_} grep {/\.deb$/} dirents '.'; # test -bbt #10........... }, + + 'braces.braces4' => { + source => "braces", + params => "braces4", + expect => <<'#11...........', +sub message { + if ( !defined( $_[0] ) ) { + print("Hello, World\n"); + } + else { + print( $_[0], "\n" ); + } + } + +$myfun = sub { + print("Hello, World\n"); + }; +#11........... + }, + + 'scbb.def' => { + source => "scbb", + params => "def", + expect => <<'#12...........', + # test -scbb: + for $w1 (@w1) { + for $w2 (@w2) { + for $w3 (@w3) { + for $w4 (@w4) { + push( @lines, "$w1 $w2 $w3 $w4\n" ); + } + } + } + } + +#12........... + }, + + 'scbb.scbb' => { + source => "scbb", + params => "scbb", + expect => <<'#13...........', + # test -scbb: + for $w1 (@w1) { + for $w2 (@w2) { + for $w3 (@w3) { + for $w4 (@w4) { + push( @lines, "$w1 $w2 $w3 $w4\n" ); + } } } } + +#13........... + }, + + 'space_paren.def' => { + source => "space_paren", + params => "def", + expect => <<'#14...........', +myfunc( $a, $b, $c ); # test -sfp +push( @array, $val ); # test -skp and also -sak='push' +split( /\|/, $txt ); # test -skp and also -sak='push' +my ( $v1, $v2 ) = @_; # test -sak='push' +#14........... + }, + + 'space_paren.space_paren1' => { + source => "space_paren", + params => "space_paren1", + expect => <<'#15...........', +myfunc ( $a, $b, $c ); # test -sfp +push ( @array, $val ); # test -skp and also -sak='push' +split ( /\|/, $txt ); # test -skp and also -sak='push' +my ( $v1, $v2 ) = @_; # test -sak='push' +#15........... + }, + + 'space_paren.space_paren2' => { + source => "space_paren", + params => "space_paren2", + expect => <<'#16...........', +myfunc( $a, $b, $c ); # test -sfp +push ( @array, $val ); # test -skp and also -sak='push' +split( /\|/, $txt ); # test -skp and also -sak='push' +my ( $v1, $v2 ) = @_; # test -sak='push' +#16........... + }, + + 'braces.braces5' => { + source => "braces", + params => "braces5", + expect => <<'#17...........', +sub message +{ + if ( !defined( $_[0] ) ) + { + print("Hello, World\n"); + } + else + { + print( $_[0], "\n" ); + } +} + +$myfun = sub { + print("Hello, World\n"); +}; +#17........... + }, + + 'braces.braces6' => { + source => "braces", + params => "braces6", + expect => <<'#18...........', +sub message { + if ( !defined( $_[0] ) ) { + print("Hello, World\n"); + } else { + print( $_[0], "\n" ); + } +} + +$myfun = sub { + print("Hello, World\n"); +}; +#18........... + }, }; my $ntests = 0 + keys %{$rtests};