Browse Source

* texrtti18.pp is no longer relevant due to 59a1199110f4b4f9d937817994c2f369365ffbbe which adds support for array properties in Extended RTTI, so move the new texrtti20.pp over to texrtti18.pp

Sven/Sarah Barth 9 months ago
parent
commit
823b376a9d
2 changed files with 27 additions and 63 deletions
  1. 27 28
      tests/test/texrtti18.pp
  2. 0 35
      tests/test/texrtti20.pp

+ 27 - 28
tests/test/texrtti18.pp

@@ -1,36 +1,35 @@
-program texrtti18;
-
-{ Test that array properties do not appear in the list of RTTI properties }
-
-{$mode objfpc}
-
-uses TypInfo, uexrttiutil;
-
-{$RTTI INHERIT
-       METHODS(DefaultMethodRttiVisibility)
-       FIELDS(DefaultFieldRttiVisibility)
-       PROPERTIES(DefaultPropertyRttiVisibility)
-}
-
-Type
-  T1 = Class(TObject)
-    function getsomething(aIndex : Integer) : TObject;
-    property Something[a: Integer] : TObject Read GetSomething;
+{$Mode ObjFpc}
+
+uses TypInfo;
+
+type
+  {$RTTI EXPLICIT 
+    FIELDS([vcPublic])
+    PROPERTIES([vcPublic,vcPublished])
+    METHODS([vcPublic,vcPublished])
+  }
+  TTestClass = class
+  public 
+    fa:integer;
+    function MyMethod(const arg1: Integer): Integer;
+    property TestIProp[const i: Longint]: Integer read MyMethod; 
+  published
+    property TestProp: Integer read fa;
   end;
 
-
-function T1.getsomething(aIndex : Integer) : TObject;
-
+function TTestClass.MyMethod(const arg1: Integer): Integer;
 begin
-  Result:=Nil;
+  Result := arg1;
 end;
 
 var
-  aCount : Integer;
-  P: PPropListEx;
-
+  pcd: PClassData;
 begin
-  aCount:=GetPropListEx(T1,P);
-  AssertEquals('class property not in RTTI properties',0,aCount);
+  pcd:=PClassData(GetTypeData(TypeInfo(TTestClass)));
+  WriteLn(pcd^.PropertyTable^.PropCount);
+  if pcd^.PropertyTable^.PropCount <> 1 then
+    Halt(1);
+  if assigned(pcd^.PropertyTable^.Prop[0]^.PropParams) then
+    Halt(2);
+  WriteLn('Ok');
 end.
-

+ 0 - 35
tests/test/texrtti20.pp

@@ -1,35 +0,0 @@
-{$Mode ObjFpc}
-
-uses TypInfo;
-
-type
-  {$RTTI EXPLICIT 
-    FIELDS([vcPublic])
-    PROPERTIES([vcPublic,vcPublished])
-    METHODS([vcPublic,vcPublished])
-  }
-  TTestClass = class
-  public 
-    fa:integer;
-    function MyMethod(const arg1: Integer): Integer;
-    property TestIProp[const i: Longint]: Integer read MyMethod; 
-  published
-    property TestProp: Integer read fa;
-  end;
-
-function TTestClass.MyMethod(const arg1: Integer): Integer;
-begin
-  Result := arg1;
-end;
-
-var
-  pcd: PClassData;
-begin
-  pcd:=PClassData(GetTypeData(TypeInfo(TTestClass)));
-  WriteLn(pcd^.PropertyTable^.PropCount);
-  if pcd^.PropertyTable^.PropCount <> 1 then
-    Halt(1);
-  if assigned(pcd^.PropertyTable^.Prop[0]^.PropParams) then
-    Halt(2);
-  WriteLn('Ok');
-end.