4 # Testing cleanup_invalid_links()
14 use Test
::More tests
=> 7;
16 use English
qw(-no_match_vars);
19 eval { remove_dir
('t/target'); };
24 # setup stow directory
26 make_file
('stow/.stow');
28 make_dir
('stow/perl/bin');
29 make_file
('stow/perl/bin/perl');
30 make_file
('stow/perl/bin/a2p');
31 make_dir
('stow/perl/info');
32 make_file
('stow/perl/info/perl');
33 make_dir
('stow/perl/lib/perl');
34 make_dir
('stow/perl/man/man1');
35 make_file
('stow/perl/man/man1/perl.1');
37 make_dir
('stow/emacs/bin');
38 make_file
('stow/emacs/bin/emacs');
39 make_file
('stow/emacs/bin/etags');
40 make_dir
('stow/emacs/info');
41 make_file
('stow/emacs/info/emacs');
42 make_dir
('stow/emacs/libexec/emacs');
43 make_dir
('stow/emacs/man/man1');
44 make_file
('stow/emacs/man/man1/emacs.1');
46 #setup target directory
48 make_link
('bin/a2p', '../stow/perl/bin/a2p');
49 make_link
('bin/emacs', '../stow/emacs/bin/emacs');
50 make_link
('bin/etags', '../stow/emacs/bin/etags');
51 make_link
('bin/perl', '../stow/perl/bin/perl');
54 make_link
('info/emacs', '../stow/emacs/info/emacs');
55 make_link
('info/perl', '../stow/perl/info/perl');
57 make_link
('lib', 'stow/perl/lib');
58 make_link
('libexec', 'stow/emacs/libexec');
62 make_link
('man/man1/emacs', '../../stow/emacs/man/man1/emacs.1');
63 make_link
('man/man1/perl', '../../stow/perl/man/man1/perl.1');
70 local @ARGV = ('-t', '.', '-b',);
73 qr{\Askipping .*stow.*\z}xms,
74 "Skip directories containing .stow");
76 # squelch warn so that check_stow doesn't carp about skipping .stow all the time
77 $SIG{'__WARN__'} = sub { };
79 @ARGV = ('-t', '.', '-l',);
82 qr{emacs\nperl\nstow\n}xms,
85 @ARGV = ('-t', '.', '-b',);
89 "No bogus links exist");
91 @ARGV = ('-t', '.', '-a',);
98 make_file
('bin/alien');
99 @ARGV = ('-t', '.', '-a',);
102 qr{Unstowed\ file:\ ./bin/alien}xms,
105 make_link
('bin/link', 'ireallyhopethisfiledoesn/t.exist');
106 @ARGV = ('-t', '.', '-b',);
109 qr{Bogus\ link:\ ./bin/link}xms,
110 "Bogus links exist");
114 ok
($::Target
== q{/usr/local},
115 "Default target is /usr/local/");