From e618ef1526f79c7c556891d9672b5630088e9a3d Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Tue, 25 Jun 2019 13:44:17 +0100 Subject: [PATCH 1/3] remove duplicate "the" typo --- bin/chkstow.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/chkstow.in b/bin/chkstow.in index 4887640..2156bb5 100755 --- a/bin/chkstow.in +++ b/bin/chkstow.in @@ -93,7 +93,7 @@ sub aliens { !-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'? sub list { if (-l) { From bd4241b3e46fa5e68177bb035fb1c0e11f6d6d49 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Tue, 25 Jun 2019 14:30:08 +0100 Subject: [PATCH 2/3] Make dotfiles.t executable for consistency with other tests --- t/dotfiles.t | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 t/dotfiles.t diff --git a/t/dotfiles.t b/t/dotfiles.t old mode 100644 new mode 100755 From 839450789197713bd906a3802b0f4b5afc9b983a Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Tue, 25 Jun 2019 14:27:56 +0100 Subject: [PATCH 3/3] Add cli.t for testing invocation of stow executable Unlike the other tests, this actually treats stow(1) as a black box script, running it directly rather than require-ing it as a library. This allows us to check things like the exit codes returned. --- MANIFEST | 1 + t/cli.t | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 t/cli.t diff --git a/MANIFEST b/MANIFEST index 056d512..91ae7bf 100644 --- a/MANIFEST +++ b/MANIFEST @@ -34,6 +34,7 @@ NEWS README.md t/chkstow.t t/cleanup_invalid_links.t +t/cli.t t/cli_options.t t/defer.t t/dotfiles.t diff --git a/t/cli.t b/t/cli.t new file mode 100644 index 0000000..0fc0528 --- /dev/null +++ b/t/cli.t @@ -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