File: win32_compile.t

package info (click to toggle)
libipc-run-perl 20231003.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 844 kB
  • sloc: perl: 6,255; makefile: 5
file content (112 lines) | stat: -rw-r--r-- 1,997 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/perl

=pod

=head1 NAME

win32_compile.t - See if IPC::Run::Win32Helper compiles, even on Unix

=cut

use strict;
use warnings;

BEGIN {
    $|  = 1;
    $^W = 1;
    if ( $ENV{PERL_CORE} ) {
        chdir '../lib/IPC/Run' if -d '../lib/IPC/Run';
        unshift @INC, 'lib', '../..';
        $^X = '../../../t/' . $^X;
    }
}

use Test::More;

BEGIN {
    unless ( eval "require 5.006" ) {
        ## NOTE: I'm working around this here because I don't want this
        ## test to fail on non-Win32 systems with older Perls.  Makefile.PL
        ## does the require 5.6.0 to protect folks on Windows.
        plan( skip_all => "perl5.00503's Socket.pm does not export IPPROTO_TCP" );
    }

    if ( $^O eq 'android' ) {
        plan( skip_all => "android does not support getprotobyname()" );
    }

    $INC{$_} = 1 for qw(
      Win32.pm Win32/Process.pm Win32/ShellQuote.pm Win32API/File.pm );

    package Win32;

    use vars qw( @ISA @EXPORT );

    @ISA    = qw( Exporter );
    @EXPORT = qw(
      CSIDL_SYSTEM
    );

    eval "sub $_ {}" for @EXPORT;

    use Exporter;

    package Win32API::File;

    use vars qw( @ISA @EXPORT );

    @ISA    = qw( Exporter );
    @EXPORT = qw(
      GetOsFHandle
      OsFHandleOpen
      OsFHandleOpenFd
      FdGetOsFHandle
      SetHandleInformation
      SetFilePointer

      HANDLE_FLAG_INHERIT

      createFile
      WriteFile
      ReadFile
      CloseHandle

      FILE_ATTRIBUTE_TEMPORARY
      FILE_FLAG_DELETE_ON_CLOSE
      FILE_FLAG_WRITE_THROUGH

      FILE_BEGIN
    );

    eval "sub $_ { 1 }" for @EXPORT;

    use Exporter;

    package Win32::Process;

    use vars qw( @ISA @EXPORT );

    @ISA    = qw( Exporter );
    @EXPORT = qw(
      NORMAL_PRIORITY_CLASS
    );

    eval "sub $_ {}" for @EXPORT;

    use Exporter;
}

{
    use Socket ();
    no warnings 'redefine';
    sub Socket::IPPROTO_TCP() { return }
}

package main;

use IPC::Run::Win32Helper;
use IPC::Run::Win32IO;

plan( tests => 1 );

ok(1);