App-psort

 view release on metacpan or  search on metacpan

t/psort.t  view on Meta::CPAN

#!/usr/bin/perl -w
# -*- perl -*-

#
# Author: Slaven Rezic
#

use strict;
use FindBin;
use File::Temp qw(tempfile);

BEGIN {
    if (!eval q{
	use Test::More;
	1;
    }) {
	print "1..0 # skip no Test::More module\n";
	exit;
    }

    *eq_or_diff = eval { require Test::Differences; \&Test::Differences::eq_or_diff } || \&Test::More::is;
}

my $use_blib = 1;
my $psort = "$FindBin::RealBin/../blib/script/psort";
unless (-f $psort) {
    # blib version not available, use ../bin source version
    $psort = "$FindBin::RealBin/../bin/psort";
    $use_blib = 0;
}

# Special handling for systems without shebang handling
my @full_script = $^O eq 'MSWin32' || !$use_blib ? ($^X, $psort) : ($psort);

my @test_defs =
    (# options
     #       in
     #              out (expected)
     #                     --check(able)
     #                        in is unsorted
     [undef, <<EOF, <<EOF, 1, 1],
c
b
a
EOF
a
b
c
EOF

    [undef, <<EOF, <<EOF, 1, 1],
abc

xyz
EOF

abc
xyz
EOF

    [undef, <<EOF, <<EOF, 1, 1],
\tTAB

EOF

\tTAB
EOF

     [undef, "", "", 1, 0],

     [undef, "\n", "\n", 1, 0],

     [undef, "one line", "one line", 1, 0],

     [undef, "one line\n", "one line\n", 1, 0],

     [["-r"], <<EOF, <<EOF, 1, 0],
c
b
a
EOF



( run in 1.187 second using v1.01-cache-2.11-cpan-6aa56a78535 )