summaryrefslogtreecommitdiff
path: root/ext/Win32
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2007-09-12 08:11:46 +0000
committerSteve Hay <SteveHay@planit.com>2007-09-12 08:11:46 +0000
commit0130bfd94175b569069a67c8e36c3b9094446d8b (patch)
treee0353310f51281e42c7833ccab7601d715540f50 /ext/Win32
parent6df974e5cec9080f83fec3cb22f1c756d1aa4628 (diff)
downloadperl-0130bfd94175b569069a67c8e36c3b9094446d8b.tar.gz
Upgrade to Win32-0.31
p4raw-id: //depot/perl@31852
Diffstat (limited to 'ext/Win32')
-rw-r--r--ext/Win32/Win32.pm2
-rw-r--r--ext/Win32/t/GetLongPathName.t6
-rw-r--r--ext/Win32/t/Names.t53
3 files changed, 57 insertions, 4 deletions
diff --git a/ext/Win32/Win32.pm b/ext/Win32/Win32.pm
index 78faf0394b..a328016b81 100644
--- a/ext/Win32/Win32.pm
+++ b/ext/Win32/Win32.pm
@@ -8,7 +8,7 @@ BEGIN {
require DynaLoader;
@ISA = qw|Exporter DynaLoader|;
- $VERSION = '0.30';
+ $VERSION = '0.31';
$XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
diff --git a/ext/Win32/t/GetLongPathName.t b/ext/Win32/t/GetLongPathName.t
index 834d8d139c..9269346467 100644
--- a/ext/Win32/t/GetLongPathName.t
+++ b/ext/Win32/t/GetLongPathName.t
@@ -29,17 +29,17 @@ push @paths, qw(
//.\/./\
);
-my $drive = $ENV{SystemDrive};
+my $drive = $ENV{SYSTEMDRIVE};
if ($drive) {
for (@paths) {
s/^c:/$drive/;
}
- push @paths, $ENV{SystemRoot} if $ENV{SystemRoot};
+ push @paths, $ENV{SYSTEMROOT} if $ENV{SYSTEMROOT};
}
my %expect;
@expect{@paths} = map { my $x = $_;
$x =~ s,(.[/\\])[/\\]+,$1,g;
- $x =~ s,^c,C,;
+ $x =~ s,^(\w):,\U$1:,;
$x } @paths;
plan tests => scalar(@paths);
diff --git a/ext/Win32/t/Names.t b/ext/Win32/t/Names.t
new file mode 100644
index 0000000000..414c4793d3
--- /dev/null
+++ b/ext/Win32/t/Names.t
@@ -0,0 +1,53 @@
+use strict;
+BEGIN {
+ eval "use Test::More";
+ return unless $@;
+ print "1..0 # Skip: Test requires Test::More module\n";
+ exit 0;
+}
+use Win32;
+
+my $tests = 14;
+$tests += 2 if Win32::IsWinNT();
+
+plan tests => $tests;
+
+# test Win32::DomainName()
+if (Win32::IsWinNT()) {
+ my $domain = eval { Win32::DomainName() };
+ is( $@, '', "Win32::DomainName()" );
+ like( $domain, '/^[a-zA-Z0-9!@#$%^&()_\'{}.~-]+$/', " - checking returned domain" );
+}
+
+# test Win32::GetArchName()
+my $archname = eval { Win32::GetArchName() };
+is( $@, '', "Win32::GetArchName()" );
+cmp_ok( length($archname), '>=', 3, " - checking returned architecture name" );
+
+# test Win32::GetChipName()
+my $chipname = eval { Win32::GetChipName() };
+is( $@, '', "Win32::GetChipName()" );
+cmp_ok( length($chipname), '>=', 3, " - checking returned chip name" );
+
+# test Win32::GetOSName()
+# - scalar context
+my $osname = eval { Win32::GetOSName() };
+is( $@, '', "Win32::GetOSName() in scalar context" );
+cmp_ok( length($osname), '>', 3, " - checking returned OS name" );
+
+# - list context
+my ($osname2, $desc) = eval { Win32::GetOSName() };
+is( $@, '', "Win32::GetOSName() in list context" );
+cmp_ok( length($osname), '>', 3, " - checking returned OS name" );
+cmp_ok( length($desc ), '>', 3, " - checking returned description" );
+is( $osname2, $osname, " - checking that OS name is the same in both calls" );
+
+# test Win32::LoginName()
+my $login = eval { Win32::LoginName() };
+is( $@, '', "Win32::LoginName()" );
+cmp_ok( length($login), '>', 1, " - checking returned login name" );
+
+# test Win32::NodeName()
+my $nodename = eval { Win32::NodeName() };
+is( $@, '', "Win32::NodeName()" );
+cmp_ok( length($nodename), '>', 1, " - checking returned node name" );