version-0.73 (was Re: Change 31920: Don't use ~0 as a version
[p5sagit/p5-mst-13.2.git] / ext / Win32 / t / Names.t
CommitLineData
0130bfd9 1use strict;
2BEGIN {
3 eval "use Test::More";
4 return unless $@;
5 print "1..0 # Skip: Test requires Test::More module\n";
6 exit 0;
7}
8use Win32;
9
10my $tests = 14;
11$tests += 2 if Win32::IsWinNT();
12
13plan tests => $tests;
14
15# test Win32::DomainName()
16if (Win32::IsWinNT()) {
17 my $domain = eval { Win32::DomainName() };
18 is( $@, '', "Win32::DomainName()" );
19 like( $domain, '/^[a-zA-Z0-9!@#$%^&()_\'{}.~-]+$/', " - checking returned domain" );
20}
21
22# test Win32::GetArchName()
23my $archname = eval { Win32::GetArchName() };
24is( $@, '', "Win32::GetArchName()" );
25cmp_ok( length($archname), '>=', 3, " - checking returned architecture name" );
26
27# test Win32::GetChipName()
28my $chipname = eval { Win32::GetChipName() };
29is( $@, '', "Win32::GetChipName()" );
30cmp_ok( length($chipname), '>=', 3, " - checking returned chip name" );
31
32# test Win32::GetOSName()
33# - scalar context
34my $osname = eval { Win32::GetOSName() };
35is( $@, '', "Win32::GetOSName() in scalar context" );
36cmp_ok( length($osname), '>', 3, " - checking returned OS name" );
37
38# - list context
39my ($osname2, $desc) = eval { Win32::GetOSName() };
40is( $@, '', "Win32::GetOSName() in list context" );
41cmp_ok( length($osname), '>', 3, " - checking returned OS name" );
42cmp_ok( length($desc ), '>', 3, " - checking returned description" );
43is( $osname2, $osname, " - checking that OS name is the same in both calls" );
44
45# test Win32::LoginName()
46my $login = eval { Win32::LoginName() };
47is( $@, '', "Win32::LoginName()" );
48cmp_ok( length($login), '>', 1, " - checking returned login name" );
49
50# test Win32::NodeName()
51my $nodename = eval { Win32::NodeName() };
52is( $@, '', "Win32::NodeName()" );
53cmp_ok( length($nodename), '>', 1, " - checking returned node name" );