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