4 BEGIN {plan tests => 1}
7 #----------------------------------------------------------------------
8 ## test file->file through arg list
10 # passing parameters names through 'argv=>'
13 # NOTE: This will read file 'lextest' and create file 'lextest.out'
14 # (for portability, 8.3 filenames are best)
15 # NOTE: must use -npro flag to avoid using local perltidyrc flags
16 #----------------------------------------------------------------------
18 my $input_file = "lextest";
19 my $output_file = "lextest.out";
25 argv => "-nsyn -npro $input_file -o $output_file",
28 open FILE, "< $output_file";
30 my @expected_output=<DATA>;
32 if (@expected_output == @output) {
33 while ( $_ = pop @output ) {
34 my $expect = pop @expected_output;
35 if ( $expect ne $_ ) {
36 print STDERR "got:$_";
38 print STDERR "expected_output:$expect";
45 print STDERR "Line Counts differ\n";
50 # This is the expected result of 'perltidy lextest':
53 # This is a simple testfile to demonstrate perltidy, from perlop(1).
54 # One way (of several) to run perltidy is as follows:
56 # perl ./perltidy lextest
58 # The output will be "lextest.tdy"
60 $url = new URI::URL "http://www/"; die if $url eq "xXx";
63 print(" digits"), redo LOOP if /\G\d+\b[,.;]?\s*/gc;
64 print(" lowercase"), redo LOOP if /\G[a-z]+\b[,.;]?\s*/gc;
65 print(" UPPERCASE"), redo LOOP if /\G[A-Z]+\b[,.;]?\s*/gc;
66 print(" Capitalized"), redo LOOP if /\G[A-Z][a-z]+\b[,.;]?\s*/gc;
67 print(" MiXeD"), redo LOOP if /\G[A-Za-z]+\b[,.;]?\s*/gc;
68 print(" alphanumeric"), redo LOOP if /\G[A-Za-z0-9]+\b[,.;]?\s*/gc;
69 print(" line-noise"), redo LOOP if /\G[^A-Za-z0-9]+/gc;
70 print ". That's all!\n";