fpc/tests/webtbs/tw14812.pp
Jonas Maebe 7e0a5aec4c * allowed open "packed" arrays (same as regular open arrays, for
compatibility with some other Pascal compilers) (mantis #14812)

git-svn-id: trunk@13918 -
2009-10-22 19:48:35 +00:00

28 lines
480 B
ObjectPascal

type
stdstrlong = string;
procedure PackStr // Convert string to packed array
( InStr: StdStrLong;
var OutArr: packed array of char);
var
i: longint;
begin
if (low(outarr)<>0) or
(high(outarr)<>5) then
halt(1);
if (instr<>'abc') then
halt(2);
for i:=1 to length(instr) do
outarr[i-1]:=instr[i];
end;
var
a: packed array[5..10] of char;
begin
packstr('abc',a);
if (a[5]<>'a') or
(a[6]<>'b') or
(a[7]<>'c') then
halt(1);
end.