Clean up coding style in tests

This commit is contained in:
Adam Spiers 2011-11-22 14:29:42 +00:00
parent a7262a98bc
commit 7bef0fb700
5 changed files with 33 additions and 33 deletions

View file

@ -63,7 +63,7 @@ sub run_chkstow() {
check_stow();
}
local @ARGV = ('-t', '.', '-b',);
local @ARGV = ('-t', '.', '-b');
stderr_like(
\&run_chkstow,
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
$SIG{'__WARN__'} = sub { };
@ARGV = ('-t', '.', '-l',);
@ARGV = ('-t', '.', '-l');
stdout_like(
\&run_chkstow,
qr{emacs\nperl\nstow\n}xms,
"List packages");
@ARGV = ('-t', '.', '-b',);
@ARGV = ('-t', '.', '-b');
stdout_like(
\&run_chkstow,
qr{\A\z}xms,
"No bogus links exist");
@ARGV = ('-t', '.', '-a',);
@ARGV = ('-t', '.', '-a');
stdout_like(
\&run_chkstow,
qr{\A\z}xms,
@ -92,20 +92,20 @@ stdout_like(
# Create an alien
make_file('bin/alien');
@ARGV = ('-t', '.', '-a',);
@ARGV = ('-t', '.', '-a');
stdout_like(
\&run_chkstow,
qr{Unstowed\ file:\ ./bin/alien}xms,
"Aliens exist");
make_link('bin/link', 'ireallyhopethisfiledoesn/t.exist');
@ARGV = ('-t', '.', '-b',);
@ARGV = ('-t', '.', '-b');
stdout_like(
\&run_chkstow,
qr{Bogus\ link:\ ./bin/link}xms,
"Bogus links exist");
@ARGV = ('-b',);
@ARGV = ('-b');
process_options();
our $Target;
ok($Target == q{/usr/local},

View file

@ -26,7 +26,7 @@ my $stow;
make_dir('../stow/pkg1/bin1');
make_file('../stow/pkg1/bin1/file1');
make_link('bin1','../stow/pkg1/bin1');
make_link('bin1', '../stow/pkg1/bin1');
$stow = new_Stow();
$stow->cleanup_invalid_links('./');
@ -41,8 +41,8 @@ is(
make_dir('bin2');
make_dir('../stow/pkg2/bin2');
make_file('../stow/pkg2/bin2/file2a');
make_link('bin2/file2a','../../stow/pkg2/bin2/file2a');
make_link('bin2/file2b','../../stow/pkg2/bin2/file2b');
make_link('bin2/file2a', '../../stow/pkg2/bin2/file2a');
make_link('bin2/file2b', '../../stow/pkg2/bin2/file2b');
$stow = new_Stow();
$stow->cleanup_invalid_links('bin2');
@ -57,8 +57,8 @@ is($stow->link_task_action('bin2/file2b'), 'remove', 'removal task for bad link'
make_dir('bin3');
make_dir('../stow/pkg3/bin3');
make_file('../stow/pkg3/bin3/file3a');
make_link('bin3/file3a','../../stow/pkg3/bin3/file3a');
make_link('bin3/file3b','../../empty');
make_link('bin3/file3a', '../../stow/pkg3/bin3/file3a');
make_link('bin3/file3b', '../../empty');
$stow = new_Stow();
$stow->cleanup_invalid_links('bin3');

View file

@ -17,7 +17,7 @@ my $stow = new_Stow(dir => 't/stow');
is(
$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'
);
@ -25,7 +25,7 @@ cd('t/target');
$stow->set_stow_dir('../stow');
is(
$stow->find_stowed_path('a/b/c','../../../stow/a/b/c'),
'../stow/a/b/c',
'../stow/a/b/c'
=> 'from target directory'
);
@ -35,13 +35,13 @@ $stow->set_stow_dir('t/target/stow');
is(
$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'
);
is(
$stow->find_stowed_path('t/target/a/b/c','../../empty'),
'',
''
=> 'target is not stowed'
);

View file

@ -13,79 +13,79 @@ use Test::More tests => 13;
is(
join_paths('a/b/c', 'd/e/f'),
'a/b/c/d/e/f',
'a/b/c/d/e/f'
=> 'simple'
);
is(
join_paths('/a/b/c', '/d/e/f'),
'/a/b/c/d/e/f',
'/a/b/c/d/e/f'
=> 'leading /'
);
is(
join_paths('/a/b/c/', '/d/e/f/'),
'/a/b/c/d/e/f',
'/a/b/c/d/e/f'
=> 'trailing /'
);
is(
join_paths('///a/b///c//', '/d///////e/f'),
'/a/b/c/d/e/f',
'/a/b/c/d/e/f'
=> 'mltiple /\'s'
);
is(
join_paths('', 'a/b/c'),
'a/b/c',
'a/b/c'
=> 'first empty'
);
is(
join_paths('a/b/c', ''),
'a/b/c',
'a/b/c'
=> 'second empty'
);
is(
join_paths('/', 'a/b/c'),
'/a/b/c',
'/a/b/c'
=> 'first is /'
);
is(
join_paths('a/b/c', '/'),
'a/b/c',
'a/b/c'
=> 'second is /'
);
is(
join_paths('///a/b///c//', '/d///////e/f'),
'/a/b/c/d/e/f',
'/a/b/c/d/e/f'
=> 'multiple /\'s'
);
is(
join_paths('../a1/b1/../c1/', '/a2/../b2/e2'),
'../a1/c1/b2/e2',
'../a1/c1/b2/e2'
=> 'simple deref ".."'
);
is(
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 ".."'
);
is(
join_paths('../a1/../../c1', 'a2/../../'),
'../..',
'../..'
=> 'too many ".."'
);
is(
join_paths('./a1', '../../a2'),
'../a2',
'../a2'
=> 'drop any "./"'
);

View file

@ -13,25 +13,25 @@ use Test::More tests => 5;
is(
parent('a/b/c'),
'a/b',
'a/b'
=> 'no leading or trailing /'
);
is(
parent('/a/b/c'),
'/a/b',
'/a/b'
=> 'leading /'
);
is(
parent('a/b/c/'),
'a/b',
'a/b'
=> 'trailing /'
);
is(
parent('/////a///b///c///'),
'/a/b',
'/a/b'
=> 'multiple /'
);