From 013b068c7650ab1ef92cab6a54da6abf39673eba Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 26 Sep 2013 19:36:15 +0200 Subject: test re-organization and code cleanup --- test/feh.t | 70 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'test/feh.t') diff --git a/test/feh.t b/test/feh.t index e530087..a9d2a04 100644 --- a/test/feh.t +++ b/test/feh.t @@ -6,11 +6,11 @@ use Test::Command tests => 71; $ENV{HOME} = 'test'; -my $feh = "src/feh"; -my $images_ok = 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm'; +my $feh = "src/feh"; +my $images_ok = 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm'; my $images_fail = 'test/fail/gif test/fail/jpg test/fail/png test/fail/pnm'; -my $images = "${images_ok} ${images_fail}"; -my $has_help = 0; +my $images = "${images_ok} ${images_fail}"; +my $has_help = 0; my $feh_name = $ENV{'PACKAGE'}; @@ -30,118 +30,115 @@ If you absolutely need to run it the other way, use EOF -if (length($feh_name) == 0) { +if ( length($feh_name) == 0 ) { die($err_no_env); } my $version = qx{$feh --version}; -if ($version =~ m{ Compile-time \s switches : \s .* help }ox) { +if ( $version =~ m{ Compile-time \s switches : \s .* help }ox ) { $has_help = 1; } -my $re_warning = - qr{${feh_name} WARNING: test/fail/... \- No Imlib2 loader for that file format\n}; -my $re_loadable = qr{test/ok/...}; -my $re_unloadable = qr{test/fail/...}; +my $re_warning + = qr{${feh_name} WARNING: test/fail/... \- No Imlib2 loader for that file format\n}; +my $re_loadable = qr{test/ok/...}; +my $re_unloadable = qr{test/fail/...}; my $re_list_action = qr{test/ok/... 16x16}; -my $cmd = Test::Command->new(cmd => "$feh --version"); +my $cmd = Test::Command->new( cmd => "$feh --version" ); $cmd->exit_is_num(0); $cmd->stderr_is_eq(''); -$cmd = Test::Command->new(cmd => "$feh --loadable $images"); +$cmd = Test::Command->new( cmd => "$feh --loadable $images" ); $cmd->exit_is_num(1); $cmd->stdout_like($re_loadable); $cmd->stderr_is_eq(''); $cmd = Test::Command->new( - cmd => "$feh --loadable --action 'echo touch %f' $images" -); + cmd => "$feh --loadable --action 'echo touch %f' $images" ); $cmd->exit_is_num(1); $cmd->stdout_is_file('test/nx_action/loadable_action'); $cmd->stderr_is_eq(''); $cmd = Test::Command->new( - cmd => "$feh --loadable --action ';echo touch %f' $images" -); + cmd => "$feh --loadable --action ';echo touch %f' $images" ); $cmd->exit_is_num(1); $cmd->stdout_is_file('test/nx_action/loadable_naction'); $cmd->stderr_is_eq(''); $cmd = Test::Command->new( - cmd => "$feh --unloadable --action 'echo rm %f' $images" -); + cmd => "$feh --unloadable --action 'echo rm %f' $images" ); $cmd->exit_is_num(1); $cmd->stdout_is_file('test/nx_action/unloadable_action'); $cmd->stderr_is_eq(''); $cmd = Test::Command->new( - cmd => "$feh --unloadable --action ';echo rm %f' $images" -); + cmd => "$feh --unloadable --action ';echo rm %f' $images" ); $cmd->exit_is_num(1); $cmd->stdout_is_file('test/nx_action/unloadable_naction'); $cmd->stderr_is_eq(''); -$cmd = Test::Command->new(cmd => "$feh --unloadable $images"); +$cmd = Test::Command->new( cmd => "$feh --unloadable $images" ); $cmd->exit_is_num(1); $cmd->stdout_like($re_unloadable); $cmd->stderr_is_eq(''); -$cmd = Test::Command->new(cmd => "$feh --list $images"); +$cmd = Test::Command->new( cmd => "$feh --list $images" ); $cmd->exit_is_num(0); $cmd->stdout_is_file('test/list/default'); $cmd->stderr_like($re_warning); for my $sort (qw/name filename width height pixels size format/) { - $cmd = Test::Command->new(cmd => "$feh --list $images --sort $sort"); + $cmd = Test::Command->new( cmd => "$feh --list $images --sort $sort" ); $cmd->exit_is_num(0); $cmd->stdout_is_file("test/list/$sort"); $cmd->stderr_like($re_warning); } -$cmd = Test::Command->new(cmd => "$feh --list $images --sort format --reverse"); +$cmd + = Test::Command->new( cmd => "$feh --list $images --sort format --reverse" ); $cmd->exit_is_num(0); $cmd->stdout_is_file('test/list/format_reverse'); $cmd->stderr_like($re_warning); $cmd = Test::Command->new( - cmd => "$feh --list --recursive --sort filename test/ok" -); + cmd => "$feh --list --recursive --sort filename test/ok" ); $cmd->exit_is_num(0); $cmd->stdout_is_file('test/list/filename_recursive'); $cmd->stderr_is_eq(''); -$cmd = Test::Command->new(cmd => "$feh --customlist '%f; %h; %l; %m; %n; %p; " - . "%s; %t; %u; %w' $images"); +$cmd = Test::Command->new( cmd => "$feh --customlist '%f; %h; %l; %m; %n; %p; " + . "%s; %t; %u; %w' $images" ); $cmd->exit_is_num(0); $cmd->stdout_is_file('test/list/custom'); $cmd->stderr_like($re_warning); -$cmd = Test::Command->new(cmd => "$feh --list --quiet $images"); +$cmd = Test::Command->new( cmd => "$feh --list --quiet $images" ); $cmd->exit_is_num(0); $cmd->stdout_is_file('test/list/default'); $cmd->stderr_is_eq(''); -$cmd = Test::Command->new(cmd => - "$feh --quiet --list --action 'echo \"%f %wx%h\" >&2' $images"); +$cmd = Test::Command->new( + cmd => "$feh --quiet --list --action 'echo \"%f %wx%h\" >&2' $images" ); $cmd->exit_is_num(0); $cmd->stdout_is_file('test/list/default'); $cmd->stderr_like($re_list_action); -$cmd = Test::Command->new(cmd => "$feh --list --min-dimension 20x20 $images_ok"); +$cmd + = Test::Command->new( cmd => "$feh --list --min-dimension 20x20 $images_ok" ); $cmd->exit_is_num(1); $cmd->stdout_is_eq(''); @@ -152,7 +149,8 @@ else { $cmd->stderr_is_file('test/no-loadable-files'); } -$cmd = Test::Command->new(cmd => "$feh --list --max-dimension 10x10 $images_ok"); +$cmd + = Test::Command->new( cmd => "$feh --list --max-dimension 10x10 $images_ok" ); $cmd->exit_is_num(1); $cmd->stdout_is_eq(''); @@ -163,13 +161,15 @@ else { $cmd->stderr_is_file('test/no-loadable-files'); } -$cmd = Test::Command->new(cmd => "$feh --list --min-dimension 16x16 $images_ok"); +$cmd + = Test::Command->new( cmd => "$feh --list --min-dimension 16x16 $images_ok" ); $cmd->exit_is_num(0); $cmd->stdout_is_file('test/list/default'); $cmd->stderr_is_eq(''); -$cmd = Test::Command->new(cmd => "$feh --list --max-dimension 16x16 $images_ok"); +$cmd + = Test::Command->new( cmd => "$feh --list --max-dimension 16x16 $images_ok" ); $cmd->exit_is_num(0); $cmd->stdout_is_file('test/list/default'); -- cgit v1.2.3