mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 11:49:23 +02:00
Add check that close on non-open files generate IOresult=103
git-svn-id: trunk@29201 -
This commit is contained in:
parent
606b0a99c7
commit
437272a037
@ -124,6 +124,24 @@ begin
|
||||
WriteLn('Passed!');
|
||||
end;
|
||||
|
||||
procedure test_already_closed_close;
|
||||
begin
|
||||
Write('closing already closed file...(IOResult=103 expected) ');
|
||||
Close(F);
|
||||
test(IOResult, 103);
|
||||
WriteLn('Passed!');
|
||||
end;
|
||||
|
||||
procedure test_not_yet_open_close(name : string);
|
||||
begin
|
||||
Write('closing assigned only file...(IOResult=103 expected) ');
|
||||
Assign(F,name);
|
||||
test(IOResult,0);
|
||||
Close(F);
|
||||
test(IOResult, 103);
|
||||
WriteLn('Passed!');
|
||||
end;
|
||||
|
||||
|
||||
procedure test_rename(oldname, newname : shortstring);
|
||||
begin
|
||||
@ -150,6 +168,7 @@ Begin
|
||||
{------------------------ create and play with a new file --------------------------}
|
||||
FillChar(readData,DATA_SIZE,0);
|
||||
|
||||
test_not_yet_open_close(FILE_NAME);
|
||||
test_do_open(FILE_NAME, MODE_REWRITE);
|
||||
test_do_write(DATA, DATA_SIZE);
|
||||
test_do_filesize(DATA_SIZE);
|
||||
@ -174,6 +193,7 @@ Begin
|
||||
RunError(255);
|
||||
*)
|
||||
test_do_close;
|
||||
test_already_closed_close;
|
||||
{------------------------ create and play with an old file --------------------------}
|
||||
FillChar(readData,DATA_SIZE,0);
|
||||
test_do_open(FILE_NAME2, MODE_REWRITE);
|
||||
|
Loading…
Reference in New Issue
Block a user