Bläddra i källkod

test: add records Self test

git-svn-id: branches/paul/extended_records@16569 -
paul 14 år sedan
förälder
incheckning
d83eab7ae8
2 ändrade filer med 29 tillägg och 0 borttagningar
  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;
   if F.P5 <> 8 then
     halt(8);
+  // test Self
+  F.Test2;
+  F.Test3;
   WriteLn('ok');
 end.

+ 26 - 0
tests/test/terecs_u1.pp

@@ -32,8 +32,13 @@ type
 
     class constructor Create;
     class destructor Destroy;
+
+    procedure Test2;
+    procedure Test3;
   end;
 
+procedure Test4(AFoo: TFoo);
+
 implementation
 
 function TFoo.Test(n: TBar): TBar;
@@ -66,4 +71,25 @@ begin
   F5 := Value;
 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.