metastr needs to be called with unquoted filename.
This commit is contained in:
parent
f3a9e35d7f
commit
14cd9fc2fb
|
@ -105,7 +105,7 @@ sub list {
|
|||
$fn = quote($fn);
|
||||
$fh_out->print($fn);
|
||||
|
||||
$fh_out->print($self->metastr($fn, $st));
|
||||
$fh_out->print($self->metastr($File::Find::name, $st));
|
||||
|
||||
$fh_out->print("\n");
|
||||
},
|
||||
|
@ -220,6 +220,16 @@ sub get {
|
|||
|
||||
}
|
||||
|
||||
=head2 metastr($fn, $st)
|
||||
|
||||
Return a string with meta information for File $fn.
|
||||
The filename must be in native (unquoted) format.
|
||||
Most meta information is taken from the File::stat object $st, but metastr may
|
||||
also get other meta information from the filename (for example, it will call
|
||||
readlink($fn) if it is a symlink). If $st is omitted, metastr will call lstat.
|
||||
|
||||
=cut
|
||||
|
||||
sub metastr {
|
||||
my ($self, $fn, $st) = @_;
|
||||
$st = lstat($fn) unless defined($st);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
use warnings;
|
||||
use strict;
|
||||
|
||||
use Test::More tests => 21;
|
||||
use Test::More tests => 22;
|
||||
|
||||
BEGIN { use_ok( 'Simba::DA' ); }
|
||||
|
||||
|
@ -19,6 +19,7 @@ cmp_ok($list, '=~', qr{^\. .* t=d }m, 'root is a directory');
|
|||
cmp_ok($list, '=~', qr{^\./test.txt .* t=f s=14 }m, 'text file found');
|
||||
cmp_ok($list, '=~', qr{^\./test.bin .* t=f s=1024 }m, 'binary file found');
|
||||
cmp_ok($list, '=~', qr{^\./test.link .* t=l .* lt=test.bin( |$)}m, 'symlink found');
|
||||
cmp_ok($list, '=~', qr{^\./ABAecom_=sub.__Am._Bankers_Assn.=_Root_CA.pem .* t=l .* lt=/usr/share/ca-certificates/mozilla/ABAecom_=sub.__Am._Bankers_Assn.=_Root_CA.crt( |$)}m, 'symlink found');
|
||||
|
||||
my $result;
|
||||
open($fh, '>', \$result);
|
||||
|
|
Loading…
Reference in New Issue