Browse Source

* test for forward class in $M+

git-svn-id: trunk@1999 -
peter 19 years ago
parent
commit
6c75825751
2 changed files with 64 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 63 0
      tests/tbs/tb0498.pp

+ 1 - 0
.gitattributes

@@ -5310,6 +5310,7 @@ tests/tbs/tb0496.pp svneol=native#text/plain
 tests/tbs/tb0497.pp -text
 tests/tbs/tb0497a.pp -text
 tests/tbs/tb0497b.pp -text
+tests/tbs/tb0498.pp svneol=native#text/plain
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain
 tests/tbs/ub0119.pp svneol=native#text/plain

+ 63 - 0
tests/tbs/tb0498.pp

@@ -0,0 +1,63 @@
+{$mode objfpc}{$H+}
+
+uses
+   Classes, SysUtils, TypInfo;
+
+
+type
+{$M+}
+   TMyTestObject = class;
+{$M-}
+
+
+   TSomeOtherClass = class(TObject)
+   private
+      FName: string;
+   public
+     property Name: string read FName write FName;
+   end;
+
+
+   TMyTestObject = class(TObject)
+   private
+      FIntProp: integer;
+      FStringProp: string;
+   public
+   published
+     property StringProp: string read FStringProp write FStringProp;
+     property IntProp: integer read FIntProp write FIntProp;
+   end;
+
+
+procedure ShowProperties;
+var
+   O: TMyTestObject;
+   i: Longint;
+   lPropFilter: TTypeKinds;
+   lCount: Longint;
+   lSize: Integer;
+   lList: PPropList;
+begin
+   O := TMyTestObject.Create;
+   lPropFilter := [tkInteger, tkAString];
+
+   lCount  := GetPropList(O.ClassInfo, lPropFilter, nil, false);
+   lSize   := lCount * SizeOf(Pointer);
+   GetMem(lList, lSize);
+
+   Writeln('Total property Count: ' + IntToStr(lCount));
+   lCount := GetPropList(O.ClassInfo, lPropFilter, lList, false);
+   for i := 0 to lCount-1 do
+   begin
+     Writeln('Property '+IntToStr(i+1)+': ' + lList^[i]^.Name);
+   end;
+
+   FreeMem(lList);
+   O.Free;
+   Writeln('---------------');
+end;
+
+
+begin
+   ShowProperties;
+end.