This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
XS DLLs shouldn't have comctl32.dll manifest in them, they dont link to it
[perl5.git] / ext / XS-APItest / t / win32.t
1 #!perl -w
2 use strict;
3 use Test::More;
4 use XS::APItest;
5 use Config;
6
7 plan skip_all => "Tests only apply on MSWin32"
8   unless $^O eq "MSWin32";
9
10 SKIP:
11 {
12     # [perl #126755] previous the bad drive tests would crash
13     $Config{ccflags} =~ /(?:\A|\s)-DPERL_IMPLICIT_SYS\b/
14       or skip "need implicit_sys for this test", 1;
15     eval "use Encode; 1"
16       or skip "Can't load Encode", 1;
17     for my $letter ("A" .. "Z", "a" .. "z") {
18         my $good_drive = $letter . ":";
19         my $result = PerlDir_mapA($good_drive);
20         like($result, qr/^$letter:\\/i, "check good drive $letter");
21
22         my $wgood_drive = encode("UTF-16LE", $good_drive . "\0");
23         $result = PerlDir_mapW($wgood_drive);
24         like(decode("UTF16-LE", $result), qr/^$letter:\\/i,
25              "check a good drive (wide)");
26     }
27     for my $bad ('@', '[', '!', '~', '`', '{') {
28         my $bad_drive = "$bad:";
29         my $result = PerlDir_mapA($bad_drive);
30         is($result, $bad_drive, "check bad drive $bad:");
31
32         my $wbad_drive = encode("UTF-16LE", $bad_drive . "\0");
33         $result = PerlDir_mapW($wbad_drive);
34         is(decode("UTF16-LE", $result), "$bad_drive\0",
35            "check bad drive $bad: (wide)");
36     }
37     require Win32;
38     my (undef, $major, $minor)=  Win32::GetOSVersion();
39     if ($major >= 5 && $minor >= 1) { #atleast XP, 2K only has V5
40     #this is testing the current state of things, specifically manifest stuff
41     #this test can be changed if perls relationship to comctl32.dll changes
42         ok((Comctl32Version())[0] >= 6,'comctl32.dll is atleast version 6')
43     }
44 }
45
46 done_testing();