From ccaf82a249d988a9192034b5afa33b754aefd379 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Fri, 4 Sep 2009 21:08:05 +0000 Subject: Bug 224588: Unify ($^O =~ /MSWin/) checks (always use ON_WINDOWS) Patch by Max Kanat-Alexander r=LpSolit, a=LpSolit --- t/001compile.t | 7 +++---- t/008filter.t | 7 ++++--- t/012throwables.t | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 't') diff --git a/t/001compile.t b/t/001compile.t index 78fc6a684..07e47160a 100644 --- a/t/001compile.t +++ b/t/001compile.t @@ -25,9 +25,8 @@ ###Compilation### use strict; - -use lib 't'; - +use lib qw(. lib t); +use Bugzilla::Constants; use Support::Files; use Test::More tests => scalar(@Support::Files::testitems); @@ -94,7 +93,7 @@ foreach my $file (@testitems) { # Special hack due to CPAN.pm on Windows with Cygwin installed throwing # strings of the form "Set up gcc environment - 3.4.4 (cygming special, # gdc 0.12, using dmd 0.125)". See bug 416047 for details. - if ($^O =~ /MSWin32/i + if (ON_WINDOWS && grep($_ eq $file, 'install-module.pl', 'Bugzilla/Install/CPAN.pm')) { $loginfo =~ s/^Set up gcc environment.*?\n//; diff --git a/t/008filter.t b/t/008filter.t index ec9e21f51..5a9e48bac 100644 --- a/t/008filter.t +++ b/t/008filter.t @@ -30,10 +30,11 @@ # Sample exploit code: '>"> use strict; -use lib 't'; +use lib qw(. lib t); use vars qw(%safe); +use Bugzilla::Constants; use Support::Templates; use File::Spec; use Test::More tests => $Support::Templates::num_actual_files; @@ -45,7 +46,7 @@ my $topdir = cwd; $/ = undef; foreach my $path (@Support::Templates::include_paths) { - $path =~ s|\\|/|g if $^O eq 'MSWin32'; # convert \ to / in path if on windows + $path =~ s|\\|/|g if ON_WINDOWS; # convert \ to / in path if on windows $path =~ m|template/([^/]+)/([^/]+)|; my $lang = $1; my $flavor = $2; @@ -66,7 +67,7 @@ foreach my $path (@Support::Templates::include_paths) { } else { do "filterexceptions.pl"; - if ($^O eq 'MSWin32') { + if (ON_WINDOWS) { # filterexceptions.pl uses / separated paths, while # find_actual_files returns \ separated ones on Windows. # Here, we convert the filter exception hash to use \. diff --git a/t/012throwables.t b/t/012throwables.t index b846ab907..4be02c58a 100644 --- a/t/012throwables.t +++ b/t/012throwables.t @@ -28,9 +28,9 @@ ######Errors###### use strict; +use lib qw(. lib t); -use lib 't'; - +use Bugzilla::Constants; use Bugzilla::WebService::Constants; use File::Spec; @@ -60,7 +60,7 @@ foreach my $include_path (@include_paths) { foreach my $path (@{$actual_files{$include_path}}) { my $file = File::Spec->catfile($include_path, $path); $file =~ s/\s.*$//; # nuke everything after the first space - $file =~ s|\\|/|g if $^O eq 'MSWin32'; # convert \ to / in path if on windows + $file =~ s|\\|/|g if ON_WINDOWS; # convert \ to / in path if on windows $test_templates{$file} = () if $file =~ m#global/(code|user)-error\.html\.tmpl#; } -- cgit v1.2.3-24-g4f1b