summaryrefslogtreecommitdiff
path: root/tests/test/tcustomattr1.pp
blob: 2c1421f6a608f76febb470384c33cea1ff8d2fa0 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
program tcustomattr1;

{$mode objfpc}{$H+}
{$modeswitch prefixedattributes}

uses
  typinfo;

type

  { tmyt }

  tmyt = class(TCustomAttribute)
    constructor create;
  end;

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

var
  at: PAttributeTable;
  AClassAttribute: TCustomAttribute;

{ tmyt }

constructor tmyt.create;
begin
  //
end;

begin
  at := GetAttributeTable(TMyObject.ClassInfo);
  if not assigned(at) then
    halt(1);
  if at^.AttributeCount<>1 then
    halt(2);

  AClassAttribute := GetAttribute(at,0);
  if AClassAttribute = nil then
    halt(3);
  writeln('ok');
end.