mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-06 00:10:19 +02:00
* runtime tests fixed
This commit is contained in:
parent
5c9b8361a4
commit
af371f5a97
@ -3,7 +3,7 @@
|
||||
{ Source provided for Free Pascal Bug Report 2159 }
|
||||
{ Submitted by "Yakov Sudeikin" on 2002-10-03 }
|
||||
{ e-mail: yashka@exebook.com }
|
||||
{$mode objfpc}
|
||||
{$ifdef fpc}{$mode objfpc}{$endif}
|
||||
|
||||
var
|
||||
a,b,c: array of string;
|
||||
@ -13,5 +13,20 @@ begin
|
||||
a[1] := 'qwe';
|
||||
b := copy(a);
|
||||
c := copy(a, 1, 1);
|
||||
if b[0]<>'asd' then
|
||||
begin
|
||||
writeln('Error 1');
|
||||
halt(1);
|
||||
end;
|
||||
if b[1]<>'qwe' then
|
||||
begin
|
||||
writeln('Error 2');
|
||||
halt(1);
|
||||
end;
|
||||
if c[0]<>'qwe' then
|
||||
begin
|
||||
writeln('Error 3');
|
||||
halt(1);
|
||||
end;
|
||||
end.
|
||||
|
||||
|
@ -31,7 +31,7 @@ list_of_string=
|
||||
stack_of_string=
|
||||
packed object (list_of_string)
|
||||
procedure pop(var s:string);
|
||||
procedure push(var s:string);
|
||||
procedure push(const s:string);
|
||||
end;
|
||||
|
||||
procedure writestring(var f:file;s:string);
|
||||
@ -136,7 +136,7 @@ var
|
||||
begin
|
||||
l:=len;
|
||||
blockwrite(f,l,sizeof(longint));
|
||||
if l>0 then p:=first;
|
||||
p:=first;
|
||||
for i:=1 to l do
|
||||
begin
|
||||
p^.save(f);
|
||||
@ -171,19 +171,29 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure stack_of_string.push(var s:string);
|
||||
procedure stack_of_string.push(const s:string);
|
||||
begin
|
||||
insert(anchor,s);
|
||||
end;
|
||||
|
||||
var
|
||||
gs:stack_of_string;
|
||||
opaddr : pointer;
|
||||
opaddr : ^string;
|
||||
begin
|
||||
opaddr:=@((gs.first)^.data);
|
||||
{perfectly compiles}
|
||||
gs.init(nil);
|
||||
gs.push('test');
|
||||
|
||||
{perfectly compiles}
|
||||
opaddr:=@((gs.first)^.data);
|
||||
writeln(opaddr^);
|
||||
if (opaddr^<>'test') then
|
||||
halt(1);
|
||||
|
||||
opaddr:=@(gs.first^.data);
|
||||
{reports error ") expected ^ but found"}
|
||||
opaddr:=@(gs.first^.data);
|
||||
writeln(opaddr^);
|
||||
if (opaddr^<>'test') then
|
||||
halt(1);
|
||||
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user