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(); 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},

View file

@ -26,7 +26,7 @@ my $stow;
make_dir('../stow/pkg1/bin1'); make_dir('../stow/pkg1/bin1');
make_file('../stow/pkg1/bin1/file1'); make_file('../stow/pkg1/bin1/file1');
make_link('bin1','../stow/pkg1/bin1'); make_link('bin1', '../stow/pkg1/bin1');
$stow = new_Stow(); $stow = new_Stow();
$stow->cleanup_invalid_links('./'); $stow->cleanup_invalid_links('./');
@ -41,8 +41,8 @@ is(
make_dir('bin2'); make_dir('bin2');
make_dir('../stow/pkg2/bin2'); make_dir('../stow/pkg2/bin2');
make_file('../stow/pkg2/bin2/file2a'); make_file('../stow/pkg2/bin2/file2a');
make_link('bin2/file2a','../../stow/pkg2/bin2/file2a'); make_link('bin2/file2a', '../../stow/pkg2/bin2/file2a');
make_link('bin2/file2b','../../stow/pkg2/bin2/file2b'); make_link('bin2/file2b', '../../stow/pkg2/bin2/file2b');
$stow = new_Stow(); $stow = new_Stow();
$stow->cleanup_invalid_links('bin2'); $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('bin3');
make_dir('../stow/pkg3/bin3'); make_dir('../stow/pkg3/bin3');
make_file('../stow/pkg3/bin3/file3a'); make_file('../stow/pkg3/bin3/file3a');
make_link('bin3/file3a','../../stow/pkg3/bin3/file3a'); make_link('bin3/file3a', '../../stow/pkg3/bin3/file3a');
make_link('bin3/file3b','../../empty'); make_link('bin3/file3b', '../../empty');
$stow = new_Stow(); $stow = new_Stow();
$stow->cleanup_invalid_links('bin3'); $stow->cleanup_invalid_links('bin3');

View file

@ -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'
); );

View file

@ -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 "./"'
); );

View file

@ -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 /'
); );