--- /dev/null
+sub message {
+ if ( !defined( $_[0] ) ) {
+ print("Hello, World\n");
+ }
+ else {
+ print( $_[0], "\n" );
+ }
+}
+
+$myfun = sub {
+ print("Hello, World\n");
+};
#
# %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 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
--fpsc=40 -iscl -nibc
+-fpsc=40 -iscl -nibc -nhsc -ssc
--kbl=2
+-kbl=2 -nolc -osbc
# 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
dump-want-right-space
extended-syntax
file-size-order
-fixed-position-side-comment
force-read-binary
format-skipping
format-skipping-begin
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
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
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
title
trim-pod
trim-qw
+use-unicode-gcstring
valign
version
vertical-tightness
$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
+ ]
};
--- /dev/null
+ sub message {
+ if ( !defined( $_[0] ) ) {
+ print("Hello, World\n");
+ }
+ else {
+ print( $_[0], "\n" );
+ }
+ } ## end sub message
--- /dev/null
+-csc -csci=2 -cscb
--- /dev/null
+sub message
+{
+ if ( !defined( $_[0] ) )
+ {
+ print("Hello, World\n");
+ }
+ else
+ {
+ print( $_[0], "\n" );
+ }
+}
+
+$myfun = sub
+{
+ print("Hello, World\n");
+};
--- /dev/null
+sub message
+{
+ if ( !defined( $_[0] ) ) {
+ print("Hello, World\n");
+ }
+ else {
+ print( $_[0], "\n" );
+ }
+}
+
+$myfun = sub {
+ print("Hello, World\n");
+};
--- /dev/null
+sub message
+ {
+ if ( !defined( $_[0] ) )
+ {
+ print("Hello, World\n");
+ }
+ else
+ {
+ print( $_[0], "\n" );
+ }
+ }
+
+$myfun = sub {
+ print("Hello, World\n");
+};
--- /dev/null
+sub message {
+ if ( !defined( $_[0] ) ) {
+ print("Hello, World\n");
+ }
+ else {
+ print( $_[0], "\n" );
+ }
+}
+
+$myfun = sub {
+ print("Hello, World\n");
+};
#!/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
{
{
} # 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
# 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__
# 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
#
# %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
#
# %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
{
{
}
}
+#<<< 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
#
# %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
--- /dev/null
+ 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
--- /dev/null
+ sub message {
+ if ( !defined( $_[0] ) ) {
+ print("Hello, World\n");
+ }
+ else {
+ print( $_[0], "\n" );
+ }
+ }
--- /dev/null
+ sub message {
+ if ( !defined( $_[0] ) ) {
+ print("Hello, World\n");
+ }
+ else {
+ print( $_[0], "\n" );
+ }
+ } ## end sub message
--- /dev/null
+return "this is a descriptive error message"
+ if $res->is_error
+ or not length $data;
--- /dev/null
+return "this is a descriptive error message"
+ if $res->is_error or not length $data;
--- /dev/null
+ dbmclose(%verb_delim);
+ undef %verb_delim;
+ dbmclose(%expanded);
+ undef %expanded;
--- /dev/null
+ dbmclose(%verb_delim); undef %verb_delim;
+ dbmclose(%expanded); undef %expanded;
--- /dev/null
+$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 );
--- /dev/null
+$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 );
--- /dev/null
+$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 );
--- /dev/null
+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"
--- /dev/null
+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"
--- /dev/null
+ # test -nola -okw
+ my $i;
+ LOOP: while ( $i = <FOTOS> ) {
+ chomp($i);
+ next unless $i;
+ fixit($i);
+ }
+
--- /dev/null
+ # test -nola -okw
+ my $i;
+ LOOP: while ( $i = <FOTOS> ) {
+ chomp($i);
+ next unless $i;
+ fixit($i);
+ }
+
--- /dev/null
+ $str1 = \"string1";
+ $str2 = \ 'string2';
--- /dev/null
+ $str1 = \"string1";
+ $str2 = \'string2';
--- /dev/null
+ $str1 = \ "string1";
+ $str2 = \ 'string2';
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+return "this is a descriptive error message"
+ if $res->is_error
+ or not length $data;
--- /dev/null
+ dbmclose(%verb_delim); undef %verb_delim;
+ dbmclose(%expanded); undef %expanded;
--- /dev/null
+$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);
--- /dev/null
+-bbao -nwls="= + - / *" -nwrs="= + - / *"
--- /dev/null
+-baao -nwls="= + - / *" -nwrs="= + - / *"
--- /dev/null
+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"
--- /dev/null
+-sts -ssc -sfs -nsak="my for" -ndsm
--- /dev/null
+# test -nola -okw
+ my $i;
+ LOOP: while ( $i = <FOTOS> ) {
+ chomp($i);
+ next unless $i;
+ fixit($i);
+ }
+
--- /dev/null
+-nola -okw
../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
--- /dev/null
+ $str1=\"string1";
+ $str2=\ 'string2';
--- /dev/null
+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
--- /dev/null
+-pt=0 -sbt=0 -bt=0 -bbt=0
--- /dev/null
+-pt=1 -sbt=1 -bt=1 -bbt=1
+
--- /dev/null
+-pt=2 -sbt=2 -bt=2 -bbt=2
+
###########################################
$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",
#
# %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 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
#!/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
{
{
} # 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
# 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__
# 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
#
# %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
#
# %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
#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'
# 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",
};
############################
############################
$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
#
# %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 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
=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' => <<'----------',
#
# %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
{
{
}
}
+#<<< 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
#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};
--- /dev/null
+# 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 );
+ }
+}