mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 08:51:10 +02:00
* also check the base types of interfaces
git-svn-id: trunk@37706 -
This commit is contained in:
parent
b1029a218a
commit
c15bcc693d
@ -1287,14 +1287,27 @@ procedure TTestCase1.TestInterface;
|
|||||||
var
|
var
|
||||||
context: TRttiContext;
|
context: TRttiContext;
|
||||||
t: TRttiType;
|
t: TRttiType;
|
||||||
|
ti1, ti2: TRttiInterfaceType;
|
||||||
begin
|
begin
|
||||||
context := TRttiContext.Create;
|
context := TRttiContext.Create;
|
||||||
try
|
try
|
||||||
t := context.GetType(TypeInfo(IInterface));
|
t := context.GetType(TypeInfo(IInterface));
|
||||||
Check(t is TRttiInterfaceType, 'Type is not an interface type');
|
Check(t is TRttiInterfaceType, 'Type is not an interface type');
|
||||||
|
|
||||||
|
Check(not Assigned(t.BaseType), 'Base type is assigned');
|
||||||
|
|
||||||
|
ti1 := TRttiInterfaceType(t);
|
||||||
|
Check(not Assigned(ti1.BaseType), 'Base type is assigned');
|
||||||
|
|
||||||
t := context.GetType(TypeInfo(ITestInterface));
|
t := context.GetType(TypeInfo(ITestInterface));
|
||||||
Check(t is TRttiInterfaceType, 'Type is not an interface type');
|
Check(t is TRttiInterfaceType, 'Type is not an interface type');
|
||||||
|
|
||||||
|
Check(Assigned(t.BaseType), 'Base type is not assigned');
|
||||||
|
Check(t.BaseType = TRttiType(ti1), 'Base type does not match');
|
||||||
|
|
||||||
|
ti2 := TRttiInterfaceType(t);
|
||||||
|
Check(Assigned(ti2.BaseType), 'Base type is not assigned');
|
||||||
|
Check(ti2.BaseType = ti1, 'Base type does not match');
|
||||||
finally
|
finally
|
||||||
context.Free;
|
context.Free;
|
||||||
end;
|
end;
|
||||||
@ -1305,11 +1318,17 @@ procedure TTestCase1.TestInterfaceRaw;
|
|||||||
var
|
var
|
||||||
context: TRttiContext;
|
context: TRttiContext;
|
||||||
t: TRttiType;
|
t: TRttiType;
|
||||||
|
ti: TRttiInterfaceType;
|
||||||
begin
|
begin
|
||||||
context := TRttiContext.Create;
|
context := TRttiContext.Create;
|
||||||
try
|
try
|
||||||
t := context.GetType(TypeInfo(ICORBATest));
|
t := context.GetType(TypeInfo(ICORBATest));
|
||||||
Check(t is TRttiInterfaceType, 'Type is not a raw interface type');
|
Check(t is TRttiInterfaceType, 'Type is not a raw interface type');
|
||||||
|
|
||||||
|
Check(not Assigned(t.BaseType), 'Base type is assigned');
|
||||||
|
|
||||||
|
ti := TRttiInterfaceType(t);
|
||||||
|
Check(not Assigned(ti.BaseType), 'Base type is assigned');
|
||||||
finally
|
finally
|
||||||
context.Free;
|
context.Free;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user