mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 16:09:25 +02:00
* added test that already works (mantis #33205)
git-svn-id: trunk@38729 -
This commit is contained in:
parent
17823821ca
commit
2eeda5d06f
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -16083,6 +16083,7 @@ tests/webtbs/tw33098.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw33167.pp svneol=native#text/pascal
|
tests/webtbs/tw33167.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3320.pp svneol=native#text/plain
|
tests/webtbs/tw3320.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw33202.pp svneol=native#text/pascal
|
tests/webtbs/tw33202.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw33205.pp -text svneol=native#text/plain
|
||||||
tests/webtbs/tw33222.pp svneol=native#text/pascal
|
tests/webtbs/tw33222.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw33230.pp svneol=native#text/pascal
|
tests/webtbs/tw33230.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3324.pp svneol=native#text/plain
|
tests/webtbs/tw3324.pp svneol=native#text/plain
|
||||||
|
78
tests/webtbs/tw33205.pp
Normal file
78
tests/webtbs/tw33205.pp
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
program BugFPC;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$MODE DELPHI}
|
||||||
|
{$ENDIF FPC}
|
||||||
|
|
||||||
|
uses
|
||||||
|
SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
TBug = record
|
||||||
|
|
||||||
|
strict private
|
||||||
|
|
||||||
|
class constructor Bugger();
|
||||||
|
|
||||||
|
public
|
||||||
|
var
|
||||||
|
a: Int32;
|
||||||
|
st: string;
|
||||||
|
arr: TBytes;
|
||||||
|
|
||||||
|
class var
|
||||||
|
|
||||||
|
skim: TBug;
|
||||||
|
|
||||||
|
constructor Create(b: Int32);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TBug }
|
||||||
|
|
||||||
|
class constructor TBug.Bugger;
|
||||||
|
begin
|
||||||
|
skim := Default (TBug);
|
||||||
|
skim.a := 5;
|
||||||
|
skim.st := 'fish';
|
||||||
|
skim.arr := TBytes.Create(1, 2, 3);
|
||||||
|
|
||||||
|
Writeln(skim.a); // should be 5
|
||||||
|
Writeln(skim.st); // should be 'fish'
|
||||||
|
Writeln(Length(skim.arr)); // should be 3
|
||||||
|
if skim.a<>5 then
|
||||||
|
halt(1);
|
||||||
|
if skim.st<>'fish' then
|
||||||
|
halt(2);
|
||||||
|
if length(skim.arr)<>3 then
|
||||||
|
halt(3);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TBug.Create(b: Int32);
|
||||||
|
var
|
||||||
|
temp: TBug;
|
||||||
|
begin
|
||||||
|
temp := skim;
|
||||||
|
Writeln(temp.a); // should be 5
|
||||||
|
Writeln(temp.st); // should be 'fish' but got ''
|
||||||
|
Writeln(Length(skim.arr)); // should be 3 but got 0
|
||||||
|
if skim.a<>5 then
|
||||||
|
halt(4);
|
||||||
|
if skim.st<>'fish' then
|
||||||
|
halt(5);
|
||||||
|
if length(skim.arr)<>3 then
|
||||||
|
halt(6);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
TBug.Create(9);
|
||||||
|
except
|
||||||
|
on E: Exception do
|
||||||
|
begin
|
||||||
|
Writeln(E.ClassName, ': ', E.Message);
|
||||||
|
halt(7);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user