Commit graph

21 commits

Author SHA1 Message Date
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
748a34b211 Revert "testutil: Add sanity check for cwd"
This reverts commit 5d4e68291e.

It turns out that this broke `make distcheck`.
2024-04-06 14:59:52 +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
ebfbb6cc13 testutil: rename parameter names to be less confusing
$target was the source of the link, and $source was the
target (destination) of the link.  Obviously this was hopelessly
confusing, so rename to avoid this.
2024-04-05 22:32:12 +01:00
Adam Spiers
67081cec02 testutil: use croak() instead of die() for more useful errors 2024-04-01 23:58:17 +01:00
Adam Spiers
d1480195b6 Move setting of cperl-indent-level to .dir-locals.el
This removes duplication.
2024-03-31 12:02:58 +01:00
Adam Spiers
5d4e68291e testutil: Add sanity check for cwd 2024-03-09 17:56:57 +00:00
Adam Spiers
a426a5979d testutil: clarify reason for default paths in new_Stow() 2024-03-09 17:56:29 +00:00
Adam Spiers
74f0182834 Add separate tests for .stowrc from $HOME and $PWD
.stowrc can be obtained from $HOME and/or the current working
directory; however only the $HOME case was tested before, because
during tests Stow was being run from $HOME.

So switch $TEST_DIR to an absolute path, create a new run_from/
subdirectory, and chdir to that before invoking any Stow code.  This
allows us to test the behaviour of .stowrc in $HOME and run_from/
separately.
2019-06-28 16:39: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
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
Charles LeDoux
048203b7f9 Change init_test_dirs to point $HOME at $OUT_DIRS
Why:

* Want to add a new feature to parsing of stowrc files.
* Need ability to write .stowrc files for testing without risk of
  squashing existing files.

This change addresses the need by:

* Reusing logic in init_test_dirs
    * init_test_dirs already creates new directory structure and overwrites
      $HOME to point into /tmp.
* This commit changes init_test_dirs to point $HOME at the newly created
  directory structure ($OUT_DIR) instead of /tmp.
    * Grants ability to write .stowrc to $HOME without fear.
    * Pointing $HOME at $OUT_DIR instead of /tmp also makes cleanup easier.
        * Remove $OUT_DIR vs remove specific files in /tmp.
2019-06-25 19:38:25 +01:00
Lucas Theisen
c171ca8d83 fixed testutil to support cygwin which reports -z = true on directories 2016-02-28 13:39:03 +00: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
7e44666640 Add --adopt / -a option. 2012-01-09 21:29:34 +00:00
Adam Spiers
10ea9c6f4b Numerous fixes so that `make distcheck' succeeds.
Moves temporary test trees into a separate directory.
2011-11-26 16:34:57 +00:00
Adam Spiers
ea82ef5b8b Add support for ignore lists. 2011-11-26 16:34:48 +00:00
Adam Spiers
dc61da22d4 Major refactoring of code into separate Stow and Stow::Util Perl modules 2011-11-24 16:56:11 +00:00
Renamed from t/util.pm (Browse further)