From 8de15394bb08713e9cb87b933085a64274f1f0ca Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Wed, 16 Nov 2011 15:16:53 +0000 Subject: [PATCH] Catch warnings in tests when no outstanding operations to perform. Tests now all pass completely cleanly. --- t/stow_contents.t | 9 +++++++-- t/unstow_contents.t | 21 +++++++++++++++++---- t/unstow_contents_orig.t | 21 +++++++++++++++++---- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/t/stow_contents.t b/t/stow_contents.t index bbfab62..e27d17b 100755 --- a/t/stow_contents.t +++ b/t/stow_contents.t @@ -7,7 +7,8 @@ # load as a library BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; } -use Test::More tests => 13; +use Test::More tests => 14; +use Test::Output; use English qw(-no_match_vars); # local utility @@ -209,7 +210,11 @@ make_link('man10/man1/file10.1' => '../../../stow/pkg10a/man10/man1/file10.1'); make_dir('../stow/pkg10b/man10/man1'); make_file('../stow/pkg10b/man10/man1/file10.1'); stow_contents('../stow/pkg10b', './', '../stow/pkg10b'); -process_tasks(); +stderr_like( + sub { process_tasks(); }, + qr/There are no outstanding operations to perform/, + 'no tasks to process' +); ok( scalar(@Conflicts) == 0 && readlink('man10/man1/file10.1') eq '../../../stow/pkg10a/man10/man1/file10.1' diff --git a/t/unstow_contents.t b/t/unstow_contents.t index e30fa2f..83c5507 100755 --- a/t/unstow_contents.t +++ b/t/unstow_contents.t @@ -7,7 +7,8 @@ # load as a library BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; } -use Test::More tests => 11; +use Test::More tests => 14; +use Test::Output; use English qw(-no_match_vars); # local utility @@ -162,7 +163,11 @@ make_file('stow/pkg7a/stow/pkg7b/file7b'); make_link('stow/pkg7b', '../stow/pkg7a/stow/pkg7b'); unstow_contents('stow/pkg7b', './'); -process_tasks(); +stderr_like( + sub { process_tasks(); }, + qr/There are no outstanding operations to perform/, + 'no tasks to process when unstowing pkg7b' +); ok( scalar(@Conflicts) == 0 && -l 'stow/pkg7b' && @@ -188,7 +193,11 @@ make_file('stow/pkg8a/stow2/pkg8b/file8b'); make_link('stow2/pkg8b', '../stow/pkg8a/stow2/pkg8b'); unstow_contents('stow/pkg8a', './'); -process_tasks(); +stderr_like( + sub { process_tasks(); }, + qr/There are no outstanding operations to perform/, + 'no tasks to process when unstowing pkg8a' +); ok( scalar(@Conflicts) == 0 && -l 'stow2/pkg8b' && @@ -240,7 +249,11 @@ make_link('man10/man1/file10b.1' => '../../../stow/pkg10b/man10/man1/file10b.1' make_dir('../stow/pkg10c/man10/man1'); make_file('../stow/pkg10c/man10/man1/file10a.1'); unstow_contents('../stow/pkg10c', './'); -process_tasks(); +stderr_like( + sub { process_tasks(); }, + qr/There are no outstanding operations to perform/, + 'no tasks to process when unstowing pkg10c' +); ok( scalar(@Conflicts) == 0 && readlink('man10/man1/file10a.1') eq '../../../stow/pkg10a/man10/man1/file10a.1' diff --git a/t/unstow_contents_orig.t b/t/unstow_contents_orig.t index 7b8c903..17fb6e1 100755 --- a/t/unstow_contents_orig.t +++ b/t/unstow_contents_orig.t @@ -7,7 +7,8 @@ # load as a library BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; } -use Test::More tests => 11; +use Test::More tests => 14; +use Test::Output; use English qw(-no_match_vars); # local utility @@ -164,7 +165,11 @@ make_file('stow/pkg7a/stow/pkg7b/file7b'); make_link('stow/pkg7b', '../stow/pkg7a/stow/pkg7b'); unstow_contents_orig('stow/pkg7b', './'); -process_tasks(); +stderr_like( + sub { process_tasks(); }, + qr/There are no outstanding operations to perform/, + 'no tasks to process when unstowing pkg7b' +); ok( scalar(@Conflicts) == 0 && -l 'stow/pkg7b' && @@ -190,7 +195,11 @@ make_file('stow/pkg8a/stow2/pkg8b/file8b'); make_link('stow2/pkg8b', '../stow/pkg8a/stow2/pkg8b'); unstow_contents_orig('stow/pkg8a', './'); -process_tasks(); +stderr_like( + sub { process_tasks(); }, + qr/There are no outstanding operations to perform/, + 'no tasks to process when unstowing pkg8a' +); ok( scalar(@Conflicts) == 0 && -l 'stow2/pkg8b' && @@ -242,7 +251,11 @@ make_link('man10/man1/file10b.1' => '../../../stow/pkg10b/man10/man1/file10b.1' make_dir('../stow/pkg10c/man10/man1'); make_file('../stow/pkg10c/man10/man1/file10a.1'); unstow_contents_orig('../stow/pkg10c', './'); -process_tasks(); +stderr_like( + sub { process_tasks(); }, + qr/There are no outstanding operations to perform/, + 'no tasks to process when unstowing pkg8a' +); ok( scalar(@Conflicts) == 0 && readlink('man10/man1/file10a.1') eq '../../../stow/pkg10a/man10/man1/file10a.1'