|
Packit |
6427f8 |
#!/usr/bin/perl
|
|
Packit |
6427f8 |
use strict;
|
|
Packit |
6427f8 |
use warnings;
|
|
Packit |
6427f8 |
use Test::More;
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
# We name our non-existant file in such a way that Win32 users know
|
|
Packit |
6427f8 |
# it's okay that we get a warning due to Perl's "call the shell
|
|
Packit |
6427f8 |
# anyway" bug.
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
use constant NO_SUCH_FILE => "this_warning_can_be_safely_ignored";
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
BEGIN {
|
|
Packit |
6427f8 |
eval "use IPC::System::Simple";
|
|
Packit |
6427f8 |
plan skip_all => "IPC::System::Simple required" if $@;
|
|
Packit |
6427f8 |
plan skip_all => "IPC::System::Simple 0.12 required"
|
|
Packit |
6427f8 |
if $IPC::System::Simple::VERSION < 0.12;
|
|
Packit |
6427f8 |
}
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
plan 'no_plan';
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
# These tests are designed to test very basic support for
|
|
Packit |
6427f8 |
# autodie under perl 5.8. They now work, but are left in
|
|
Packit |
6427f8 |
# useful simple tests.
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
eval {
|
|
Packit |
6427f8 |
use autodie qw(open);
|
|
Packit |
6427f8 |
open(my $fh, '<', NO_SUCH_FILE);
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
};
|
|
Packit |
6427f8 |
ok($@);
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
eval {
|
|
Packit |
6427f8 |
open(my $fh, '<', NO_SUCH_FILE);
|
|
Packit |
6427f8 |
};
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
ok(! $@);
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
eval {
|
|
Packit |
6427f8 |
use autodie qw(system);
|
|
Packit |
6427f8 |
system(NO_SUCH_FILE,1);
|
|
Packit |
6427f8 |
};
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
ok($@);
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
eval {
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
# Because Perl *always* calls the shell under Win32, even
|
|
Packit |
6427f8 |
# though mutli-arg system shouldn't, we always get a warning
|
|
Packit |
6427f8 |
# (from the shell, not perl) for the line below.
|
|
Packit |
6427f8 |
#
|
|
Packit |
6427f8 |
# IPC::System::Simple and autodie's system() never call the
|
|
Packit |
6427f8 |
# shell when called with multiple arguments.
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
warn "\nPlease ignore the following warning, it is expected\n"
|
|
Packit |
6427f8 |
if $^O eq "MSWin32";
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
no warnings;
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
system(NO_SUCH_FILE,1);
|
|
Packit |
6427f8 |
};
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
ok(! $@);
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
{
|
|
Packit |
6427f8 |
no warnings; # Disables "can't exec..." warning.
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
# Test exotic system.
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
eval " system { NO_SUCH_FILE } 1; ";
|
|
Packit |
6427f8 |
|
|
Packit |
6427f8 |
ok(! $@);
|
|
Packit |
6427f8 |
}
|