* small fixes

This commit is contained in:
peter 2001-08-01 21:41:27 +00:00
parent fbef0b4610
commit a576e82342
3 changed files with 19 additions and 80 deletions
tests

View File

@ -1,7 +1,7 @@
uses
sysutils;
{ comment by submitter:
{ comment by submitter:
The following statement (which works in Delphi)
result:=Format('%10.n', [ival*1.0]);
generated an unhandled exception (and said: Missing argument in format "").
@ -23,8 +23,11 @@ var
ival : integer;
begin
ThousandSeparator:='.';
DecimalSeparator:=',';
ival:=1234;
s:=Format('%10.n', [ival*1.0]);
writeln('s: "',s,'"');
if s<>' 1.234' then
begin
writeln('Problem with Format');

View File

@ -1,76 +0,0 @@
{ %fail% }
uses
Objects;
var
Coll : PCollection;
Thing : PObject;
Line1 : String; {*** This is a global variable ***}
procedure Zero;
var
Line2 : String; {*** This is a local variable ***}
procedure Two (Thing: PObject);
begin
Line1 := 'BBB';
Line2 := 'BBB';
WriteLn('2: ', Line1, ' * ', Line2); {*** Output line 2 ***}
if Line2<>'BBB' then
begin
writeln('ERROR!');
halt(1);
end;
end;
procedure One (Thing: PObject);
procedure LocalTwo (Thing: PObject);
begin
Line1 := 'BBB';
Line2 := 'BBB';
WriteLn('2: ', Line1, ' * ', Line2); {*** Output line 2 ***}
if Line2<>'BBB' then
begin
writeln('ERROR!');
halt(1);
end;
end;
begin
Line1 := 'AAA';
Line2 := 'AAA';
WriteLn('1: ', Line1, ' * ', Line2); {*** Output line 1 ***}
Coll^.ForEach(@LocalTwo);
WriteLn('3: ', Line1, ' * ', Line2); {*** Output line 3 ***}
if Line2<>'BBB' then
begin
writeln('ERROR!');
halt(1);
end;
end;
{*** I expected that output line 3 ***}
begin {*** would be the same as output ***}
Coll^.ForEach(@One); {*** line 2. It is not. ***}
end;
begin
New(Coll, Init(1, 1));
New(Thing, Init);
Coll^.Insert(Thing);
Zero;
Dispose(Coll, Done);
end.

View File

@ -6,13 +6,25 @@ type
procedure Test(const Args: array of TPoint);
begin
{$ifndef VER1_0}
writeln(length(Args));
if length(Args)<>2 then
halt(1);
{$endif VER1_0}
writeln(high(Args));
if high(Args)<>1 then
halt(1);
writeln(Args[0].x,',',Args[0].y);
if (Args[0].x<>10) and (Args[0].y<>10) then
if (Args[0].x<>10) or (Args[0].y<>20) then
halt(1);
writeln(Args[1].x,',',Args[1].y);
if (Args[1].x<>30) or (Args[1].y<>40) then
halt(1);
end;
const
p1: TPoint = (x: 10; y: 10);
p1: TPoint = (x: 10; y: 20);
p2: TPoint = (x: 30; y: 40);
begin
Test([p1]);
Test([p1,p2]);
end.