summaryrefslogtreecommitdiff
path: root/classattributes/tests/test/tclassattribute9.pp
blob: 93a046b81b01a7b392a8e07c89edcfccf81c97ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
program tclassattribute9;

{$mode objfpc}{$H+}

uses
  typinfo;

type
  { tmyt }
  tmyt = class(TCustomAttribute);

type
  [Tmyt]
  TMyObject = class(TObject)
  end;

var
  td: PTypeData;
  AClassAttribute: TCustomAttribute;

begin
  td := GetTypeData(TMyObject.ClassInfo);
  if td^.AttributeCount<>1 then
    halt(1);

  AClassAttribute := GetClassAttribute(td,0) as TCustomAttribute;
  if AClassAttribute = nil then
    halt(2);
  writeln('ok');
end.