[darcs-devel] darcs patch: RT #255 Comprehensible shell test output
(and 2 more)
schwern at pobox.com
schwern at pobox.com
Fri Mar 11 19:38:08 PST 2005
Fri Mar 11 13:26:47 PST 2005 schwern at pobox.com
* RT #255 Comprehensible shell test output
Fri Mar 11 19:11:20 PST 2005 schwern at pobox.com
* Test::Darcs. darcs() instead of `$DARCS ...`
All the perl tests repeat this mantra to find darcs:
use vars qw/$DARCS/;
die 'darcs not found' unless $ENV{DARCS} || (-x "$ENV{PWD}/../darcs");
$DARCS = $ENV{DARCS} || "$ENV{PWD}/../darcs";
And then they call $DARCS directly via a shell command. `$DARCS ...`
Repeated code is bad and all that shell is likely to become a compatibility
liability.
This patch creats a library Test::Darcs and in it darcs() which replaces
`$DARCS ...`. I've converted add.pl to use it as a demonstration.
One of the issues is now in order to run an individual Perl test file you
must add -Ilib/perl so it can find Test::Darcs. Alternatively one can
add "use lib qw(lib/perl)" to all the Perl tests. I don't know which is
better for darcs developers. The latter is redundant but potentially less
confusing.
More testing libraries for tests/lib/perl to follow.
Fri Mar 11 19:35:30 PST 2005 schwern at pobox.com
* Shell::Command to replace shell calls in perl tests
The perl tests make shell calls for trivial things which can be done
just fine in Perl like touch, mkdir, rm -rf. These are compatibility
problems waiting to happen.
There is an existing module which provides Perl functions similar to common
shell commands, Shell::Command. It is a wrapper around the core module
ExtUtils::Command. I've provided a copy here so darcs users do not have to
download and install it to run the tests.
This patch converts add.pl to use Shell::Command eliminating all `` calls
in that test as a demonstration.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 118724 bytes
Desc: A darcs patch for your repository!
Url : http://lists.osuosl.org/pipermail/darcs-devel/attachments/20050311/d23ebec1/attachment.bin
More information about the darcs-devel
mailing list