mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 18:09:27 +02:00
parent
ae476a9b6a
commit
d6aa5bfe36
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8969,6 +8969,7 @@ tests/webtbs/tw1068.pp svneol=native#text/plain
|
||||
tests/webtbs/tw10681.pp svneol=native#text/plain
|
||||
tests/webtbs/tw10684.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1071.pp svneol=native#text/plain
|
||||
tests/webtbs/tw10717.pp svneol=native#text/plain
|
||||
tests/webtbs/tw10727.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1073.pp svneol=native#text/plain
|
||||
tests/webtbs/tw10736.pp svneol=native#text/plain
|
||||
|
141
tests/webtbs/tw10717.pp
Normal file
141
tests/webtbs/tw10717.pp
Normal file
@ -0,0 +1,141 @@
|
||||
program filefunctest;
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$mode objfpc}{$H+}
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
SysUtils;
|
||||
|
||||
|
||||
type
|
||||
tsingletestresults = array[1..5] of string;
|
||||
tresults = array[1..5] of tsingletestresults;
|
||||
const
|
||||
{$ifdef unix}
|
||||
results: tresults =
|
||||
(
|
||||
(
|
||||
'ExtractFilePath on ''./:'' = ''./''',
|
||||
'ExtractFileName on ''./:'' = '':''',
|
||||
'ExtractFileDrive on ''./:'' = ''''',
|
||||
'IncludeTrailingPathDelimiter on ''./:'' = ''./:/''',
|
||||
'ExcludeTrailingPathDelimiter on ''./:'' = ''./:'''
|
||||
),
|
||||
|
||||
(
|
||||
'ExtractFilePath on ''C:/blah:blah'' = ''C:/''',
|
||||
'ExtractFileName on ''C:/blah:blah'' = ''blah:blah''',
|
||||
'ExtractFileDrive on ''C:/blah:blah'' = ''''',
|
||||
'IncludeTrailingPathDelimiter on ''C:/blah:blah'' = ''C:/blah:blah/''',
|
||||
'ExcludeTrailingPathDelimiter on ''C:/blah:blah'' = ''C:/blah:blah'''
|
||||
),
|
||||
|
||||
(
|
||||
'ExtractFilePath on ''./\'' = ''./''',
|
||||
'ExtractFileName on ''./\'' = ''\''',
|
||||
'ExtractFileDrive on ''./\'' = ''''',
|
||||
'IncludeTrailingPathDelimiter on ''./\'' = ''./\/''',
|
||||
'ExcludeTrailingPathDelimiter on ''./\'' = ''./\'''
|
||||
),
|
||||
|
||||
(
|
||||
'ExtractFilePath on ''./c:'' = ''./''',
|
||||
'ExtractFileName on ''./c:'' = ''c:''',
|
||||
'ExtractFileDrive on ''./c:'' = ''''',
|
||||
'IncludeTrailingPathDelimiter on ''./c:'' = ''./c:/''',
|
||||
'ExcludeTrailingPathDelimiter on ''./c:'' = ''./c:'''
|
||||
),
|
||||
|
||||
(
|
||||
'ExtractFilePath on ''\\server\share\file'' = ''''',
|
||||
'ExtractFileName on ''\\server\share\file'' = ''\\server\share\file''',
|
||||
'ExtractFileDrive on ''\\server\share\file'' = ''''',
|
||||
'IncludeTrailingPathDelimiter on ''\\server\share\file'' = ''\\server\share\file/''',
|
||||
'ExcludeTrailingPathDelimiter on ''\\server\share\file'' = ''\\server\share\file'''
|
||||
)
|
||||
);
|
||||
{$else}
|
||||
results: tresults =
|
||||
(
|
||||
(
|
||||
'ExtractFilePath on ''./:'' = ''./:''',
|
||||
'ExtractFileName on ''./:'' = ''''',
|
||||
'ExtractFileDrive on ''./:'' = ''''',
|
||||
'IncludeTrailingPathDelimiter on ''./:'' = ''./:\''',
|
||||
'ExcludeTrailingPathDelimiter on ''./:'' = ''./:'''
|
||||
),
|
||||
|
||||
(
|
||||
'ExtractFilePath on ''C:/blah:blah'' = ''C:/blah:''',
|
||||
'ExtractFileName on ''C:/blah:blah'' = ''blah''',
|
||||
'ExtractFileDrive on ''C:/blah:blah'' = ''C:''',
|
||||
'IncludeTrailingPathDelimiter on ''C:/blah:blah'' = ''C:/blah:blah\''',
|
||||
'ExcludeTrailingPathDelimiter on ''C:/blah:blah'' = ''C:/blah:blah'''
|
||||
),
|
||||
|
||||
(
|
||||
'ExtractFilePath on ''./\'' = ''./\''',
|
||||
'ExtractFileName on ''./\'' = ''''',
|
||||
'ExtractFileDrive on ''./\'' = ''''',
|
||||
'IncludeTrailingPathDelimiter on ''./\'' = ''./\''',
|
||||
'ExcludeTrailingPathDelimiter on ''./\'' = ''./'''
|
||||
),
|
||||
|
||||
(
|
||||
'ExtractFilePath on ''./c:'' = ''./c:''',
|
||||
'ExtractFileName on ''./c:'' = ''''',
|
||||
'ExtractFileDrive on ''./c:'' = ''''',
|
||||
'IncludeTrailingPathDelimiter on ''./c:'' = ''./c:\''',
|
||||
'ExcludeTrailingPathDelimiter on ''./c:'' = ''./c:'''
|
||||
),
|
||||
|
||||
(
|
||||
'ExtractFilePath on ''\\server\share\file'' = ''\\server\share\''',
|
||||
'ExtractFileName on ''\\server\share\file'' = ''file''',
|
||||
'ExtractFileDrive on ''\\server\share\file'' = ''\\server\share''',
|
||||
'IncludeTrailingPathDelimiter on ''\\server\share\file'' = ''\\server\share\file\''',
|
||||
'ExcludeTrailingPathDelimiter on ''\\server\share\file'' = ''\\server\share\file'''
|
||||
)
|
||||
);
|
||||
{$endif}
|
||||
|
||||
procedure TestFuncs(const strPath: string; const results: tsingletestresults);
|
||||
begin
|
||||
WriteLn(Format('ExtractFilePath on ''%s'' = ''%s''',
|
||||
[strPath, ExtractFilePath(strPath)]));
|
||||
WriteLn(Format('ExtractFileName on ''%s'' = ''%s''',
|
||||
[strPath, ExtractFileName(strPath)]));
|
||||
WriteLn(Format('ExtractFileDrive on ''%s'' = ''%s''',
|
||||
[strPath, ExtractFileDrive(strPath)]));
|
||||
WriteLn(Format('IncludeTrailingPathDelimiter on ''%s'' = ''%s''',
|
||||
[strPath, IncludeTrailingPathDelimiter(strPath)]));
|
||||
WriteLn(Format('ExcludeTrailingPathDelimiter on ''%s'' = ''%s''',
|
||||
[strPath, ExcludeTrailingPathDelimiter(strPath)]));
|
||||
|
||||
if (Format('ExtractFilePath on ''%s'' = ''%s''',[strPath, ExtractFilePath(strPath)]) <> results[1]) then
|
||||
halt(1);
|
||||
if (Format('ExtractFileName on ''%s'' = ''%s''',[strPath, ExtractFileName(strPath)]) <> results[2]) then
|
||||
halt(2);
|
||||
if (Format('ExtractFileDrive on ''%s'' = ''%s''',[strPath, ExtractFileDrive(strPath)]) <> results[3]) then
|
||||
halt(3);
|
||||
if (Format('IncludeTrailingPathDelimiter on ''%s'' = ''%s''',[strPath, IncludeTrailingPathDelimiter(strPath)]) <> results[4]) then
|
||||
halt(4);
|
||||
if (Format('ExcludeTrailingPathDelimiter on ''%s'' = ''%s''',[strPath, ExcludeTrailingPathDelimiter(strPath)]) <> results[5]) then
|
||||
halt(5);
|
||||
|
||||
WriteLn;
|
||||
end;
|
||||
|
||||
begin
|
||||
{$ifdef unix}
|
||||
{ make settings Kylix-compatible }
|
||||
AllowDriveSeparators:=[];
|
||||
AllowDirectorySeparators:=['/'];
|
||||
{$endif}
|
||||
TestFuncs('./:',results[1]);
|
||||
TestFuncs('C:/blah:blah',results[2]);
|
||||
TestFuncs('./\',results[3]);
|
||||
TestFuncs('./c:',results[4]);
|
||||
TestFuncs('\\server\share\file',results[5]);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user