develooper Front page | perl.moose | Postings from January 2012

Incompatibility between Test::Command and System::Command?

Thread Next
From:
Buddy Burden
Date:
January 3, 2012 14:55
Subject:
Incompatibility between Test::Command and System::Command?
Message ID:
CAL0mxoTJigGtRE143NUhoQNu8rwR49nn7M1+rmFoqwbw3uZ+2g@mail.gmail.com
Guys,

Okay, I got it down to this, but I can't seem to narrow it down
further.  Time to call in the big guns.(*)

This code:

#! /usr/bin/perl

use Test::More 0.88;
use Test::Command;

stderr_like(q{ perl -le 'print STDERR "STDERR points to ", readlink
"/proc/self/fd/2"' },
        qr/STDERR points to/, 'should always pass');

done_testing;

produces this output (as expected):

[tyr:~] ./test.t
ok 1 - should always pass
1..1

However, _this_ code:

#! /usr/bin/perl

use Test::More 0.88;
use Test::Command;

use System::Command;

stderr_like(q{ perl -le 'print STDERR "STDERR points to ", readlink
"/proc/self/fd/2"' },
        qr/STDERR points to/, 'should always pass');

done_testing;

produces this:

[tyr:~] ./test.t
STDERR points to /dev/pts/0
not ok 1 - should always pass
#   Failed test 'should always pass'
#   at ./test.t line 8.
#                   ''
#     doesn't match '(?-xism:STDERR points to)'
1..1
# Looks like you failed 1 test of 1.

which is entirely unexpected.  Can anyone tell me:

1) What's going on here?
2) Is there any way to work around it?
3) Is there perhaps another way to do what I'm trying to do that won't
trigger this?

To clarify #3, I'm not actually using System::Command, I'm using
Git::Repository (which uses Git::Repository::Command, which uses
System::Command).  I'm using Git::Respository so I can do this test:

lives_ok { Git::Repository->new( work_tree => $packages_dir ) } 'basic
sanity check: packages dir is in a Git repo';

which works great, but perhaps there's another way to do this without
using G::R, which is obviously causing me issues.

TIA for any suggestions you guys have!  (And happy 2012, everybody!)


            -- Buddy


(*) That's you guys. ;->

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About