Add black box CLI testing and 2 other tweaks (#36)
Add black box CLI testing and 2 other tweaks
This commit is contained in:
commit
1e9fa23d2e
4 changed files with 52 additions and 1 deletions
1
MANIFEST
1
MANIFEST
|
@ -34,6 +34,7 @@ NEWS
|
||||||
README.md
|
README.md
|
||||||
t/chkstow.t
|
t/chkstow.t
|
||||||
t/cleanup_invalid_links.t
|
t/cleanup_invalid_links.t
|
||||||
|
t/cli.t
|
||||||
t/cli_options.t
|
t/cli_options.t
|
||||||
t/defer.t
|
t/defer.t
|
||||||
t/dotfiles.t
|
t/dotfiles.t
|
||||||
|
|
|
@ -93,7 +93,7 @@ sub aliens {
|
||||||
!-l && !-d && print "Unstowed file: $File::Find::name\n";
|
!-l && !-d && print "Unstowed file: $File::Find::name\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
# just list the packages in the the target directory
|
# just list the packages in the target directory
|
||||||
# FIXME: what if the stow dir is not called 'stow'?
|
# FIXME: what if the stow dir is not called 'stow'?
|
||||||
sub list {
|
sub list {
|
||||||
if (-l) {
|
if (-l) {
|
||||||
|
|
50
t/cli.t
Normal file
50
t/cli.t
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/usr/local/bin/perl
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test processing of CLI options.
|
||||||
|
#
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
use Test::More tests => 1;
|
||||||
|
|
||||||
|
use testutil;
|
||||||
|
|
||||||
|
#init_test_dirs();
|
||||||
|
|
||||||
|
# Since here we're doing black-box testing on the stow executable,
|
||||||
|
# this looks like it should be robust:
|
||||||
|
#
|
||||||
|
#my $STOW = dirname(__FILE__) . '/../bin/stow';
|
||||||
|
#
|
||||||
|
# but unfortunately it breaks things like "make distcheck", which
|
||||||
|
# builds the stow script into a separate path like
|
||||||
|
#
|
||||||
|
# stow-2.3.0/_build/sub/bin
|
||||||
|
#
|
||||||
|
# before cd'ing to something like
|
||||||
|
#
|
||||||
|
# stow-2.3.0/_build/sub
|
||||||
|
#
|
||||||
|
# and then running the tests via:
|
||||||
|
#
|
||||||
|
# make check-TESTS
|
||||||
|
# make[2]: Entering directory '/path/to/stow/src/stow-2.3.0/_build/sub'
|
||||||
|
# dir=../../t; \
|
||||||
|
# /usr/bin/perl -Ibin -Ilib -I../../t -MTest::Harness -e 'runtests(@ARGV)' "${dir#./}"/*.t
|
||||||
|
#
|
||||||
|
# So the simplest solution is to hardcode an assumption that we run
|
||||||
|
# tests either from somewhere like this during distcheck:
|
||||||
|
#
|
||||||
|
# stow-2.3.0/_build/sub
|
||||||
|
#
|
||||||
|
# or from the top of the source tree during development. This can be done
|
||||||
|
# via the following, which also follows the KISS principle:
|
||||||
|
my $STOW = 'bin/stow';
|
||||||
|
|
||||||
|
`$STOW --help`;
|
||||||
|
is($?, 0, "--help should return 0 exit code");
|
||||||
|
|
||||||
|
# vim:ft=perl
|
0
t/dotfiles.t
Normal file → Executable file
0
t/dotfiles.t
Normal file → Executable file
Loading…
Reference in a new issue