Browse Source

Add testing of use of variable of class

git-svn-id: trunk@41417 -
pierre 6 years ago
parent
commit
1a564de6e6
1 changed files with 7 additions and 1 deletions
  1. 7 1
      tests/test/units/classes/tmakeobjinst.pp

+ 7 - 1
tests/test/units/classes/tmakeobjinst.pp

@@ -5,6 +5,7 @@ uses
 
 type
   tc1 = class
+    var a : longint;
     procedure p(var msg : TMessage);
   end;
 
@@ -14,7 +15,7 @@ procedure tc1.p(var msg : TMessage);
   begin
     if (msg.msg<>1) or (msg.wparam<>2) or (msg.lparam<>3) then
       halt(1);
-    msg.result:=4;
+    msg.result:=4+a;
   end;
 
 var
@@ -22,10 +23,15 @@ var
   c : tc1;
 begin
   c:=tc1.create;
+  c.a:=0;
+
   f:=tf(MakeObjectInstance(@c.p));
 
   if f(0,1,2,3)<>4 then
     halt(1);
+  c.a:=3;
+  if f(0,1,2,3)<>7 then
+    halt(2);
 
   c.free;