Clean up coding style in tests
This commit is contained in:
parent
a7262a98bc
commit
7bef0fb700
5 changed files with 33 additions and 33 deletions
14
t/chkstow.t
14
t/chkstow.t
|
@ -63,7 +63,7 @@ sub run_chkstow() {
|
||||||
check_stow();
|
check_stow();
|
||||||
}
|
}
|
||||||
|
|
||||||
local @ARGV = ('-t', '.', '-b',);
|
local @ARGV = ('-t', '.', '-b');
|
||||||
stderr_like(
|
stderr_like(
|
||||||
\&run_chkstow,
|
\&run_chkstow,
|
||||||
qr{\Askipping .*stow.*\z}xms,
|
qr{\Askipping .*stow.*\z}xms,
|
||||||
|
@ -72,19 +72,19 @@ stderr_like(
|
||||||
# squelch warn so that check_stow doesn't carp about skipping .stow all the time
|
# squelch warn so that check_stow doesn't carp about skipping .stow all the time
|
||||||
$SIG{'__WARN__'} = sub { };
|
$SIG{'__WARN__'} = sub { };
|
||||||
|
|
||||||
@ARGV = ('-t', '.', '-l',);
|
@ARGV = ('-t', '.', '-l');
|
||||||
stdout_like(
|
stdout_like(
|
||||||
\&run_chkstow,
|
\&run_chkstow,
|
||||||
qr{emacs\nperl\nstow\n}xms,
|
qr{emacs\nperl\nstow\n}xms,
|
||||||
"List packages");
|
"List packages");
|
||||||
|
|
||||||
@ARGV = ('-t', '.', '-b',);
|
@ARGV = ('-t', '.', '-b');
|
||||||
stdout_like(
|
stdout_like(
|
||||||
\&run_chkstow,
|
\&run_chkstow,
|
||||||
qr{\A\z}xms,
|
qr{\A\z}xms,
|
||||||
"No bogus links exist");
|
"No bogus links exist");
|
||||||
|
|
||||||
@ARGV = ('-t', '.', '-a',);
|
@ARGV = ('-t', '.', '-a');
|
||||||
stdout_like(
|
stdout_like(
|
||||||
\&run_chkstow,
|
\&run_chkstow,
|
||||||
qr{\A\z}xms,
|
qr{\A\z}xms,
|
||||||
|
@ -92,20 +92,20 @@ stdout_like(
|
||||||
|
|
||||||
# Create an alien
|
# Create an alien
|
||||||
make_file('bin/alien');
|
make_file('bin/alien');
|
||||||
@ARGV = ('-t', '.', '-a',);
|
@ARGV = ('-t', '.', '-a');
|
||||||
stdout_like(
|
stdout_like(
|
||||||
\&run_chkstow,
|
\&run_chkstow,
|
||||||
qr{Unstowed\ file:\ ./bin/alien}xms,
|
qr{Unstowed\ file:\ ./bin/alien}xms,
|
||||||
"Aliens exist");
|
"Aliens exist");
|
||||||
|
|
||||||
make_link('bin/link', 'ireallyhopethisfiledoesn/t.exist');
|
make_link('bin/link', 'ireallyhopethisfiledoesn/t.exist');
|
||||||
@ARGV = ('-t', '.', '-b',);
|
@ARGV = ('-t', '.', '-b');
|
||||||
stdout_like(
|
stdout_like(
|
||||||
\&run_chkstow,
|
\&run_chkstow,
|
||||||
qr{Bogus\ link:\ ./bin/link}xms,
|
qr{Bogus\ link:\ ./bin/link}xms,
|
||||||
"Bogus links exist");
|
"Bogus links exist");
|
||||||
|
|
||||||
@ARGV = ('-b',);
|
@ARGV = ('-b');
|
||||||
process_options();
|
process_options();
|
||||||
our $Target;
|
our $Target;
|
||||||
ok($Target == q{/usr/local},
|
ok($Target == q{/usr/local},
|
||||||
|
|
|
@ -17,7 +17,7 @@ my $stow = new_Stow(dir => 't/stow');
|
||||||
|
|
||||||
is(
|
is(
|
||||||
$stow->find_stowed_path('t/target/a/b/c', '../../../stow/a/b/c'),
|
$stow->find_stowed_path('t/target/a/b/c', '../../../stow/a/b/c'),
|
||||||
't/stow/a/b/c',
|
't/stow/a/b/c'
|
||||||
=> 'from root'
|
=> 'from root'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ cd('t/target');
|
||||||
$stow->set_stow_dir('../stow');
|
$stow->set_stow_dir('../stow');
|
||||||
is(
|
is(
|
||||||
$stow->find_stowed_path('a/b/c','../../../stow/a/b/c'),
|
$stow->find_stowed_path('a/b/c','../../../stow/a/b/c'),
|
||||||
'../stow/a/b/c',
|
'../stow/a/b/c'
|
||||||
=> 'from target directory'
|
=> 'from target directory'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -35,13 +35,13 @@ $stow->set_stow_dir('t/target/stow');
|
||||||
|
|
||||||
is(
|
is(
|
||||||
$stow->find_stowed_path('t/target/a/b/c', '../../stow/a/b/c'),
|
$stow->find_stowed_path('t/target/a/b/c', '../../stow/a/b/c'),
|
||||||
't/target/stow/a/b/c',
|
't/target/stow/a/b/c'
|
||||||
=> 'stow is subdir of target directory'
|
=> 'stow is subdir of target directory'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
$stow->find_stowed_path('t/target/a/b/c','../../empty'),
|
$stow->find_stowed_path('t/target/a/b/c','../../empty'),
|
||||||
'',
|
''
|
||||||
=> 'target is not stowed'
|
=> 'target is not stowed'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -13,79 +13,79 @@ use Test::More tests => 13;
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('a/b/c', 'd/e/f'),
|
join_paths('a/b/c', 'd/e/f'),
|
||||||
'a/b/c/d/e/f',
|
'a/b/c/d/e/f'
|
||||||
=> 'simple'
|
=> 'simple'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('/a/b/c', '/d/e/f'),
|
join_paths('/a/b/c', '/d/e/f'),
|
||||||
'/a/b/c/d/e/f',
|
'/a/b/c/d/e/f'
|
||||||
=> 'leading /'
|
=> 'leading /'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('/a/b/c/', '/d/e/f/'),
|
join_paths('/a/b/c/', '/d/e/f/'),
|
||||||
'/a/b/c/d/e/f',
|
'/a/b/c/d/e/f'
|
||||||
=> 'trailing /'
|
=> 'trailing /'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('///a/b///c//', '/d///////e/f'),
|
join_paths('///a/b///c//', '/d///////e/f'),
|
||||||
'/a/b/c/d/e/f',
|
'/a/b/c/d/e/f'
|
||||||
=> 'mltiple /\'s'
|
=> 'mltiple /\'s'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('', 'a/b/c'),
|
join_paths('', 'a/b/c'),
|
||||||
'a/b/c',
|
'a/b/c'
|
||||||
=> 'first empty'
|
=> 'first empty'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('a/b/c', ''),
|
join_paths('a/b/c', ''),
|
||||||
'a/b/c',
|
'a/b/c'
|
||||||
=> 'second empty'
|
=> 'second empty'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('/', 'a/b/c'),
|
join_paths('/', 'a/b/c'),
|
||||||
'/a/b/c',
|
'/a/b/c'
|
||||||
=> 'first is /'
|
=> 'first is /'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('a/b/c', '/'),
|
join_paths('a/b/c', '/'),
|
||||||
'a/b/c',
|
'a/b/c'
|
||||||
=> 'second is /'
|
=> 'second is /'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('///a/b///c//', '/d///////e/f'),
|
join_paths('///a/b///c//', '/d///////e/f'),
|
||||||
'/a/b/c/d/e/f',
|
'/a/b/c/d/e/f'
|
||||||
=> 'multiple /\'s'
|
=> 'multiple /\'s'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('../a1/b1/../c1/', '/a2/../b2/e2'),
|
join_paths('../a1/b1/../c1/', '/a2/../b2/e2'),
|
||||||
'../a1/c1/b2/e2',
|
'../a1/c1/b2/e2'
|
||||||
=> 'simple deref ".."'
|
=> 'simple deref ".."'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('../a1/b1/../c1/d1/e1', '../a2/../b2/c2/d2/../e2'),
|
join_paths('../a1/b1/../c1/d1/e1', '../a2/../b2/c2/d2/../e2'),
|
||||||
'../a1/c1/d1/b2/c2/e2',
|
'../a1/c1/d1/b2/c2/e2'
|
||||||
=> 'complex deref ".."'
|
=> 'complex deref ".."'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('../a1/../../c1', 'a2/../../'),
|
join_paths('../a1/../../c1', 'a2/../../'),
|
||||||
'../..',
|
'../..'
|
||||||
=> 'too many ".."'
|
=> 'too many ".."'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
join_paths('./a1', '../../a2'),
|
join_paths('./a1', '../../a2'),
|
||||||
'../a2',
|
'../a2'
|
||||||
=> 'drop any "./"'
|
=> 'drop any "./"'
|
||||||
);
|
);
|
||||||
|
|
|
@ -13,25 +13,25 @@ use Test::More tests => 5;
|
||||||
|
|
||||||
is(
|
is(
|
||||||
parent('a/b/c'),
|
parent('a/b/c'),
|
||||||
'a/b',
|
'a/b'
|
||||||
=> 'no leading or trailing /'
|
=> 'no leading or trailing /'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
parent('/a/b/c'),
|
parent('/a/b/c'),
|
||||||
'/a/b',
|
'/a/b'
|
||||||
=> 'leading /'
|
=> 'leading /'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
parent('a/b/c/'),
|
parent('a/b/c/'),
|
||||||
'a/b',
|
'a/b'
|
||||||
=> 'trailing /'
|
=> 'trailing /'
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
parent('/////a///b///c///'),
|
parent('/////a///b///c///'),
|
||||||
'/a/b',
|
'/a/b'
|
||||||
=> 'multiple /'
|
=> 'multiple /'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue