Skip to content

Commit

Permalink
t/script.t tests against cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Aug 28, 2024
1 parent b86c3c8 commit ed7c65b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions t/script.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use strict;
use warnings;
use Test::Most tests => 64;
use File::Spec;
use File::HomeDir;
use Cwd;
use Test::NoWarnings;
use Tie::Filehandle::Preempt::Stdin;
Expand Down Expand Up @@ -194,15 +193,17 @@ PATHS: {
delete $ENV{'DOCUMENT_ROOT'};
$i = new_ok('CGI::Info');
ok($i->script_name() eq 'bar.pl');
my $home = File::HomeDir->my_home();
my $dir = Cwd::getcwd();
if($^O eq 'MSWin32') {
TODO: {
local $TODO = 'Script_dir test needs to be done on Windows';
like($i->script_dir(), qr/$home/, 'Check script_dir looks right');
# like($i->script_dir(), qr/$dir/, 'Check script_dir looks right');
cmp_ok($i->script_dir(), 'eq', $dir, 'Check script_dir looks right');
ok($i->script_path() =~ /\\.+bar\.pl$/);
}
} else {
like($i->script_dir(), qr/$home/, 'Check script_dir looks right');
# like($i->script_dir(), qr/$dir/, 'Check script_dir looks right');
cmp_ok($i->script_dir(), 'eq', $dir, 'Check script_dir looks right');
ok($i->script_path() =~ /\/.+bar\.pl$/);
}

Expand Down

0 comments on commit ed7c65b

Please sign in to comment.