"Fossies" - the Fresh Open Source Software Archive

Member "Perl-Tidy-20190915/t/testss.t" (7 Jun 2006, 1425 Bytes) of package /linux/misc/Perl-Tidy-20190915.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 use strict;
    2 use Test;
    3 use Carp;
    4 BEGIN {plan tests => 1}
    5 use Perl::Tidy; 
    6 
    7 
    8 #----------------------------------------------------------------------
    9 ## test string->string 
   10 #----------------------------------------------------------------------
   11 my $source = <<'EOM';
   12 %height=("letter",27.9, "legal",35.6, "arche",121.9, "archd",91.4, "archc",61,
   13  "archb",45.7, "archa",30.5, "flsa",33, "flse",33, "halfletter",21.6,
   14  "11x17",43.2, "ledger",27.9);
   15 %width=("letter",21.6, "legal",21.6, "arche",91.4, "archd",61, "archc",45.7,
   16  "archb",30.5, "archa",22.9, "flsa",21.6, "flse",21.6, "halfletter",14,
   17  "11x17",27.9, "ledger",43.2);
   18 EOM
   19 
   20 my $perltidyrc = <<'EOM';
   21 -gnu
   22 EOM
   23 
   24 my $output;
   25 
   26 Perl::Tidy::perltidy(
   27     source      => \$source,
   28     destination => \$output,
   29     perltidyrc  => \$perltidyrc,
   30     argv        => '-nsyn',
   31 );
   32 
   33 my $expected_output=<<'EOM';
   34 %height = (
   35            "letter",     27.9, "legal", 35.6, "arche",  121.9,
   36            "archd",      91.4, "archc", 61,   "archb",  45.7,
   37            "archa",      30.5, "flsa",  33,   "flse",   33,
   38            "halfletter", 21.6, "11x17", 43.2, "ledger", 27.9
   39           );
   40 %width = (
   41           "letter",     21.6, "legal", 21.6, "arche",  91.4,
   42           "archd",      61,   "archc", 45.7, "archb",  30.5,
   43           "archa",      22.9, "flsa",  21.6, "flse",   21.6,
   44           "halfletter", 14,   "11x17", 27.9, "ledger", 43.2
   45          );
   46 EOM
   47 ok($output, $expected_output);