Commit graph

17 commits

Author SHA1 Message Date
Adam Spiers 94ed916466 t/unstow.t: move final set of tests into a subtest 2024-04-07 17:44:44 +01:00
Adam Spiers c0b8890b14 t/unstow.t: remove superfluous spaces 2024-04-07 17:24:13 +01:00
Adam Spiers 8ed799a3a3 t/unstow.t: create a bunch of unowned files to make tests more robust
This should make it harder for Stow to do the right thing.
2024-04-07 17:21:10 +01:00
Adam Spiers 744ba651f5 unstow_link_node(): don't register conflicts when unstowing unowned links 2024-04-07 15:47:38 +01:00
Adam Spiers 06fdfc185f merge unstow_orig.t into unstow.t and fix unstowing logic
There was a ton of duplication which is not maintainable, so refactor
everything into a single test which still covers the differences.

This in turn revealed some issues in the unstowing logic:

- We shouldn't conflict if we find a file which isn't a link or a
  directory; we can just skip over it.

- Unstowing with `--dotfiles` was using the wrong variable to obtain
  the package path, and as a result having to perform an unnecessary
  call to `adjust_dotfile()`.

So fix those at the same time.
2024-04-07 15:47:38 +01:00
Adam Spiers e9ad20576c t/unstow.t: convert to use subtests 2024-04-06 11:59:23 +01:00
Adam Spiers bca711fac2 tests: use stderr_like() instead of home-grown STDERR capturing
The STDERR capturing in testutil just reinvents Test::Output which
we already use in chkstow.t, so it's pointless to reinvent that wheel.
2024-04-06 11:33:18 +01:00
Adam Spiers a2beb7b371 Separate treatment of .stow and .nonstow marked dirs
Placing a .stow file in a directory tells Stow that this directory
should be considered a Stow directory.  This is already
well-documented.

There was an undocumented and slightly broken feature where placing a
.nonstow file in a directory was treated in exactly the same way.  The
intention was for .nonstow to cause Stow to skip stowing into and
unstowing from that directory and any of its descendants.  However, it
also caused Stow to consider symlinks into any of those directories as
owned by Stow, even though that was clearly not the intention.  So
separate treatment of .stow and .nonstow markers, so that while both
provide protection against Stow stowing and unstowing, only .stow
affects the symlink ownership logic in find_stowed_path() and
marked_stow_dir().

Probably no one uses the undocumented .nonstow feature, so it may make
sense to remove this in future.
2024-03-31 12:15:53 +01:00
Adam Spiers 6233298a91 Replace testutil::make_dir with File::Path::make_path
No need for a custom function here.
2019-06-28 01:02:48 +01:00
Adam Spiers ba48fd3908 Rename $OUT_DIR to $TEST_DIR
This is a more accurate reflection of what it is.
2019-06-28 00:53:12 +01:00
Adam Spiers 0979a9c7bd Change #!/usr/local/bin/perl to #!/usr/bin/perl in t/*.t
This doesn't really matter, since these are not executed directly, but
it's more consistent with everything else and modern systems.
2019-06-27 20:37:50 +01:00
Adam Spiers 27796720d5 Upgrade to GPL v3 and add headers to files (#44)
Following advice from maintainers@gnu.org, bring Stow in line with
other GNU projects by upgrading it from GPL v2 to v3

  https://www.gnu.org/prep/maintain/html_node/Licensing-of-GNU-Packages.html#Licensing-of-GNU-Packages

as obtained in plain text and texinfo formats from

  https://www.gnu.org/licenses/

and adding appropriate headers:

  https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Code.html#License-Notices-for-Code

Fixes #44: https://github.com/aspiers/stow/issues/44
2019-06-27 20:37:40 +01:00
Adam Spiers 07a84541f1 make it more obvious when target (sub)directory is skipped
This should avoid the sort of confusion seen in:

  https://github.com/aspiers/shell-env/issues/1
2014-09-23 01:37:54 +01:00
Adam Spiers ed12c787df Add --no-folding option. 2012-02-18 20:33:34 +00:00
Adam Spiers 91c816e32d Use make_invalid_link() to reliably setup symlink fixtures. 2012-02-18 20:33:34 +00:00
Adam Spiers 8357dca645 Remove "There are no outstanding operations to perform" warning.
This is more in keeping with the UNIX convention of no output on success,
and is also the way Stow v1.x behaved.  Thanks to Adam Sampson for the suggestion.
2012-01-11 14:01:40 +00:00
Adam Spiers 0c6d5639e3 Rename test files to reflect their purpose. 2012-01-09 22:12:49 +00:00
Renamed from t/unstow_contents.t (Browse further)