[monitoring-plugin-perl] fix test in windows

Sven Nierlein git at monitoring-plugins.org
Sun Dec 28 13:50:03 CET 2014


 Module: monitoring-plugin-perl
 Branch: master
 Commit: 0f6dcbe3e653fbb92b52ac42b2a9564953983c1f
 Author: Sven Nierlein <sven at nierlein.de>
   Date: Sun Dec 28 13:48:02 2014 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugin-perl/commit/?id=0f6dcbe

fix test in windows

on windows backslashes are expected instead of forward slashes.

fixes https://rt.cpan.org/Ticket/Display.html?id=100708

Signed-off-by: Sven Nierlein <sven at nierlein.de>

---

 t/Monitoring-Plugin-Getopt-03.t | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/t/Monitoring-Plugin-Getopt-03.t b/t/Monitoring-Plugin-Getopt-03.t
index 6490145..bcf324e 100644
--- a/t/Monitoring-Plugin-Getopt-03.t
+++ b/t/Monitoring-Plugin-Getopt-03.t
@@ -97,7 +97,10 @@ for my $infile (glob File::Spec->catfile($tdir, 'input', $glob)) {
       if ($@) {
         chomp $@;
         ok($infile =~ m/_(dies?|catch)$/, "$infile ($@)");
-        is($@, $EXPECTED{$infile}, $infile) if ($infile =~ m/_catch$/);
+        my $expect = $EXPECTED{$infile};
+        # windows expects backslashes fixes rt.cpan #100708
+        $expect =~ s#/#\\#gmx if $^O =~ m/^MSWin/;
+        is($@, $expect, $infile) if ($infile =~ m/_catch$/);
       }
       else {
         is($plugin . ' ' . $ng->_cmdline, $EXPECTED{$infile}, $infile);



More information about the Commits mailing list