Browse Source

test: add records Self test

git-svn-id: branches/paul/extended_records@16569 -
paul 14 years ago
parent
commit
d83eab7ae8
2 changed files with 29 additions and 0 deletions
  1. 3 0
      tests/test/terecs3.pp
  2. 26 0
      tests/test/terecs_u1.pp

+ 3 - 0
tests/test/terecs3.pp

@@ -29,5 +29,8 @@ begin
   F.P5 := 8;
   F.P5 := 8;
   if F.P5 <> 8 then
   if F.P5 <> 8 then
     halt(8);
     halt(8);
+  // test Self
+  F.Test2;
+  F.Test3;
   WriteLn('ok');
   WriteLn('ok');
 end.
 end.

+ 26 - 0
tests/test/terecs_u1.pp

@@ -32,8 +32,13 @@ type
 
 
     class constructor Create;
     class constructor Create;
     class destructor Destroy;
     class destructor Destroy;
+
+    procedure Test2;
+    procedure Test3;
   end;
   end;
 
 
+procedure Test4(AFoo: TFoo);
+
 implementation
 implementation
 
 
 function TFoo.Test(n: TBar): TBar;
 function TFoo.Test(n: TBar): TBar;
@@ -66,4 +71,25 @@ begin
   F5 := Value;
   F5 := Value;
 end;
 end;
 
 
+procedure TFoo.Test2;
+begin
+  if Self.C <> 1 then
+    halt(50);
+  if Self.F3 <> 7 then
+    halt(51);
+end;
+
+procedure TFoo.Test3;
+begin
+  Test4(Self);
+end;
+
+procedure Test4(AFoo: TFoo);
+begin
+  if AFoo.C <> 1 then
+    halt(100);
+  if AFoo.P3 <> 7 then
+    halt(101);
+end;
+
 end.
 end.