1use strict; 2use Test; 3use Win32; 4 5BEGIN { 6 Win32::CreateFile("8dot3test_canary_GetShortPathName $$"); 7 my $canary = Win32::GetShortPathName("8dot3test_canary_GetShortPathName $$"); 8 unlink("8dot3test_canary_GetShortPathName $$"); 9 if ( length $canary > 12 ) { 10 print "1..0 # Skip: The system and/or current volume is not configured to support short names.\n"; 11 exit 0; 12 } 13} 14 15my $path = "Long Path $$"; 16unlink($path); 17END { unlink $path } 18 19plan tests => 5; 20 21Win32::CreateFile($path); 22ok(-f $path); 23 24my $short = Win32::GetShortPathName($path); 25ok($short, qr/^\S{1,8}(\.\S{1,3})?$/); 26ok(-f $short); 27 28unlink($path); 29ok(!-f $path); 30ok(!defined Win32::GetShortPathName($path)); 31