From 4dce3d0ce8f1f2921f291b4df9a7b058524976b6 Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Mon, 9 Jan 2012 18:32:06 +0000 Subject: [PATCH] Use get_conflict_count() in tests since get_conflicts() no longer returns a flat structure. --- t/cleanup_invalid_links.t | 4 ++-- t/examples.t | 10 +++++----- t/stow_contents.t | 14 +++++++------- t/unstow_contents.t | 28 ++++++++++++++-------------- t/unstow_contents_orig.t | 28 ++++++++++++++-------------- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/t/cleanup_invalid_links.t b/t/cleanup_invalid_links.t index e6edd9d..f0f164b 100755 --- a/t/cleanup_invalid_links.t +++ b/t/cleanup_invalid_links.t @@ -46,7 +46,7 @@ make_link('bin2/file2b', '../../stow/pkg2/bin2/file2b'); $stow = new_Stow(); $stow->cleanup_invalid_links('bin2'); -is(scalar($stow->get_conflicts), 0, 'no conflicts cleaning up bad link'); +is($stow->get_conflict_count, 0, 'no conflicts cleaning up bad link'); is(scalar($stow->get_tasks), 1, 'one task cleaning up bad link'); is($stow->link_task_action('bin2/file2b'), 'remove', 'removal task for bad link'); @@ -62,5 +62,5 @@ make_link('bin3/file3b', '../../empty'); $stow = new_Stow(); $stow->cleanup_invalid_links('bin3'); -is(scalar($stow->get_conflicts), 0, 'no conflicts cleaning up bad link not owned by stow'); +is($stow->get_conflict_count, 0, 'no conflicts cleaning up bad link not owned by stow'); is(scalar($stow->get_tasks), 0, 'no tasks cleaning up bad link not owned by stow'); diff --git a/t/examples.t b/t/examples.t index 42894ef..7320ed5 100755 --- a/t/examples.t +++ b/t/examples.t @@ -54,7 +54,7 @@ $stow = new_Stow(dir => 'stow'); $stow->plan_stow('perl'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -l 'bin' && -l 'info' && -l 'lib' && -l 'man' && readlink('bin') eq 'stow/perl/bin' && readlink('info') eq 'stow/perl/info' && @@ -81,7 +81,7 @@ $stow = new_Stow(dir => 'stow'); $stow->plan_stow('perl'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -d 'bin' && -d 'lib' && -d 'man' && -d 'man/man1' && -l 'info' && -l 'bin/perl' && -l 'bin/a2p' && -l 'lib/perl' && -l 'man/man1/perl.1' && @@ -107,7 +107,7 @@ remove_dir('man'); $stow = new_Stow(dir => 'stow'); $stow->plan_stow('perl', 'emacs'); $stow->process_tasks(); -is(scalar($stow->get_conflicts), 0, 'no conflicts'); +is($stow->get_conflict_count, 0, 'no conflicts'); ok( -d 'bin' && -l 'bin/perl' && @@ -157,7 +157,7 @@ $stow = new_Stow(dir => 'stow'); $stow->plan_stow('pkg1a', 'pkg1b'); $stow->plan_unstow('pkg1b'); $stow->process_tasks(); -is(scalar($stow->get_conflicts), 0, 'no conflicts stowing empty dirs'); +is($stow->get_conflict_count, 0, 'no conflicts stowing empty dirs'); ok(-d 'bin1' => 'bug 1: stowing empty dirs'); # @@ -177,7 +177,7 @@ $stow->set_stow_dir('stow2b'); $stow->plan_stow('pkg2b'); $stow->process_tasks(); -is(scalar($stow->get_conflicts), 0, 'no conflicts splitting tree-folding symlinks'); +is($stow->get_conflict_count, 0, 'no conflicts splitting tree-folding symlinks'); ok(-d 'bin2' => 'tree got split by packages from multiple stow directories'); ok(-f 'bin2/file2a' => 'file from 1st stow dir'); ok(-f 'bin2/file2b' => 'file from 2nd stow dir'); diff --git a/t/stow_contents.t b/t/stow_contents.t index 4a5775a..24e01dc 100755 --- a/t/stow_contents.t +++ b/t/stow_contents.t @@ -157,7 +157,7 @@ make_file('../stow/pkg8b/0/file8b'); $stow->plan_stow('pkg8b'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -d '0' && readlink('0/file8a') eq '../../stow/pkg8a/0/file8a' && readlink('0/file8b') eq '../../stow/pkg8b/0/file8b' @@ -179,7 +179,7 @@ make_file('../stow/pkg9b/man9/man1/file9.1'); $stow->plan_stow('pkg9b'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && readlink('man9/man1/file9.1') eq '../../../stow/pkg9b/man9/man1/file9.1' => 'overriding existing documentation files' ); @@ -204,7 +204,7 @@ stderr_like( 'no tasks to process' ); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && readlink('man10/man1/file10.1') eq '../../../stow/pkg10a/man10/man1/file10.1' => 'defer to existing documentation files' ); @@ -223,7 +223,7 @@ make_dir('man11/man1'); $stow->plan_stow('pkg11'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && readlink('man11/man1/file11.1') eq '../../../stow/pkg11/man11/man1/file11.1' && !-e 'man11/man1/file11.1~' && !-e 'man11/man1/.#file11.1' @@ -243,7 +243,7 @@ make_dir('lib12/'); $stow->plan_stow('pkg12'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && readlink('lib12/lib.so.1') eq '../../stow/pkg12/lib12/lib.so.1' => 'stow links to libraries' ); @@ -265,7 +265,7 @@ make_link('../stow/pkg13b/lib13/libb.so.1', 'libb.so'); $stow->plan_stow('pkg13b'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && readlink('lib13/liba.so.1') eq '../../stow/pkg13a/lib13/liba.so.1' && readlink('lib13/libb.so.1') eq '../../stow/pkg13b/lib13/libb.so.1' => 'unfolding to stow links to libraries' @@ -287,7 +287,7 @@ stderr_like( 'no tasks to process' ); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && ! -l 'stow/pkg15' => "stowing to stow dir should fail" ); diff --git a/t/unstow_contents.t b/t/unstow_contents.t index d398065..08af8ca 100755 --- a/t/unstow_contents.t +++ b/t/unstow_contents.t @@ -34,7 +34,7 @@ make_link('bin1', '../stow/pkg1/bin1'); $stow->plan_unstow('pkg1'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -f '../stow/pkg1/bin1/file1' && ! -e 'bin1' => 'unstow a simple tree' ); @@ -51,7 +51,7 @@ make_link('lib2/file2', '../../stow/pkg2/lib2/file2'); $stow->plan_unstow('pkg2'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -f '../stow/pkg2/lib2/file2' && -d 'lib2' => 'unstow simple tree from a pre-existing directory' ); @@ -73,7 +73,7 @@ make_link('bin3/file3b' => '../../stow/pkg3b/bin3/file3b'); # emulate stow $stow->plan_unstow('pkg3b'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -l 'bin3' && readlink('bin3') eq '../stow/pkg3a/bin3' => 'fold tree after unstowing' @@ -92,7 +92,7 @@ make_link('bin4/file4', '../../stow/pkg4/bin4/does-not-exist'); $stow->plan_unstow('pkg4'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && ! -e 'bin4/file4' => q(remove invalid link owned by stow) ); @@ -128,7 +128,7 @@ make_file('../stow/pkg6b/bin6/file6'); $stow->plan_unstow('pkg6b'); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -l 'bin6/file6' && readlink('bin6/file6') eq '../../stow/pkg6a/bin6/file6' => q(ignore existing link that points to a different package) @@ -152,7 +152,7 @@ stderr_like( 'no tasks to process when unstowing pkg7b' ); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -l 'stow/pkg7b' && readlink('stow/pkg7b') eq '../stow/pkg7a/stow/pkg7b' => q(don't unlink any nodes under the stow directory) @@ -178,7 +178,7 @@ stderr_like( 'no tasks to process when unstowing pkg8a' ); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -l 'stow2/pkg8b' && readlink('stow2/pkg8b') eq '../stow/pkg8a/stow2/pkg8b' => q(don't unlink any nodes under another stow directory) @@ -200,7 +200,7 @@ make_file('../stow/pkg9b/man9/man1/file9.1'); $stow->plan_unstow('pkg9b'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && !-l 'man9/man1/file9.1' => 'overriding existing documentation files' ); @@ -230,7 +230,7 @@ stderr_like( 'no tasks to process when unstowing pkg10c' ); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && readlink('man10/man1/file10a.1') eq '../../../stow/pkg10a/man10/man1/file10a.1' => 'defer to existing documentation files' ); @@ -250,7 +250,7 @@ make_link('man12/man1/file12.1' => '../../../stow/pkg12/man12/man1/file12.1'); $stow->plan_unstow('pkg12'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && !-e 'man12/man1/file12.1' => 'ignore temp files' ); @@ -266,7 +266,7 @@ stderr_like( 'no tasks to process when unstowing pkg12' ); ok( - scalar($stow->get_conflicts) == 0 + $stow->get_conflict_count == 0 => 'unstow already unstowed package pkg12' ); @@ -285,7 +285,7 @@ stderr_like( 'no tasks to process when unstowing pkg12 which was never stowed' ); ok( - scalar($stow->get_conflicts) == 0 + $stow->get_conflict_count == 0 => 'unstow never stowed package pkg12' ); @@ -341,7 +341,7 @@ make_link("$OUT_DIR/target/bin14", '../stow/pkg14/bin14'); $stow->plan_unstow('pkg14'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -f "$OUT_DIR/stow/pkg14/bin14/file14" && ! -e "$OUT_DIR/target/bin14" => 'unstow a simple tree with absolute stow dir' ); @@ -360,7 +360,7 @@ make_link("$OUT_DIR/target/bin15", '../stow/pkg15/bin15'); $stow->plan_unstow('pkg15'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -f "$OUT_DIR/stow/pkg15/bin15/file15" && ! -e "$OUT_DIR/target/bin15" => 'unstow a simple tree with absolute stow and target dirs' ); diff --git a/t/unstow_contents_orig.t b/t/unstow_contents_orig.t index 436668a..4ce750e 100755 --- a/t/unstow_contents_orig.t +++ b/t/unstow_contents_orig.t @@ -35,7 +35,7 @@ make_link('bin1', '../stow/pkg1/bin1'); $stow->plan_unstow('pkg1'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -f '../stow/pkg1/bin1/file1' && ! -e 'bin1' => 'unstow a simple tree' ); @@ -52,7 +52,7 @@ make_link('lib2/file2', '../../stow/pkg2/lib2/file2'); $stow->plan_unstow('pkg2'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -f '../stow/pkg2/lib2/file2' && -d 'lib2' => 'unstow simple tree from a pre-existing directory' ); @@ -74,7 +74,7 @@ make_link('bin3/file3b' => '../../stow/pkg3b/bin3/file3b'); # emulate stow $stow->plan_unstow('pkg3b'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -l 'bin3' && readlink('bin3') eq '../stow/pkg3a/bin3' => 'fold tree after unstowing' @@ -93,7 +93,7 @@ make_link('bin4/file4', '../../stow/pkg4/bin4/does-not-exist'); $stow->plan_unstow('pkg4'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && ! -e 'bin4/file4' => q(remove invalid link owned by stow) ); @@ -134,7 +134,7 @@ make_file('../stow/pkg6b/bin6/file6'); $stow->plan_unstow('pkg6b'); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -l 'bin6/file6' && readlink('bin6/file6') eq '../../stow/pkg6a/bin6/file6' => q(ignore existing link that points to a different package) @@ -158,7 +158,7 @@ stderr_like( 'no tasks to process when unstowing pkg7b' ); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -l 'stow/pkg7b' && readlink('stow/pkg7b') eq '../stow/pkg7a/stow/pkg7b' => q(don't unlink any nodes under the stow directory) @@ -184,7 +184,7 @@ stderr_like( 'no tasks to process when unstowing pkg8a' ); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -l 'stow2/pkg8b' && readlink('stow2/pkg8b') eq '../stow/pkg8a/stow2/pkg8b' => q(don't unlink any nodes under another stow directory) @@ -206,7 +206,7 @@ make_file('../stow/pkg9b/man9/man1/file9.1'); $stow->plan_unstow('pkg9b'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && !-l 'man9/man1/file9.1' => 'overriding existing documentation files' ); @@ -236,7 +236,7 @@ stderr_like( 'no tasks to process when unstowing pkg10c' ); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && readlink('man10/man1/file10a.1') eq '../../../stow/pkg10a/man10/man1/file10a.1' => 'defer to existing documentation files' ); @@ -256,7 +256,7 @@ make_link('man12/man1/file12.1' => '../../../stow/pkg12/man12/man1/file12.1'); $stow->plan_unstow('pkg12'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && !-e 'man12/man1/file12.1' => 'ignore temp files' ); @@ -272,7 +272,7 @@ stderr_like( 'no tasks to process when unstowing pkg12' ); ok( - scalar($stow->get_conflicts) == 0 + $stow->get_conflict_count == 0 => 'unstow already unstowed package pkg12' ); @@ -291,7 +291,7 @@ stderr_like( 'no tasks to process when unstowing pkg12 which was never stowed' ); ok( - scalar($stow->get_conflicts) == 0 + $stow->get_conflict_count == 0 => 'unstow never stowed package pkg12' ); @@ -347,7 +347,7 @@ make_link("$OUT_DIR/target/bin14", '../stow/pkg14/bin14'); $stow->plan_unstow('pkg14'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -f "$OUT_DIR/stow/pkg14/bin14/file14" && ! -e "$OUT_DIR/target/bin14" => 'unstow a simple tree with absolute stow dir' ); @@ -366,7 +366,7 @@ make_link("$OUT_DIR/target/bin15", '../stow/pkg15/bin15'); $stow->plan_unstow('pkg15'); $stow->process_tasks(); ok( - scalar($stow->get_conflicts) == 0 && + $stow->get_conflict_count == 0 && -f "$OUT_DIR/stow/pkg15/bin15/file15" && ! -e "$OUT_DIR/target/bin15" => 'unstow a simple tree with absolute stow and target dirs' );