浏览代码

* Do not test variants with equal memory area: e.g. strings may point to different memory areas

Michaël Van Canneyt 2 年之前
父节点
当前提交
b99a1adf8b
共有 1 个文件被更改,包括 4 次插入5 次删除
  1. 4 5
      packages/rtl-objpas/tests/tests.rtti.util.pas

+ 4 - 5
packages/rtl-objpas/tests/tests.rtti.util.pas

@@ -241,15 +241,14 @@ begin
     {$ifdef fpc}
       tkObject,
     {$endif}
-      tkMethod,
-      tkVariant: begin
+      tkMethod:
+      begin
         if aValue1.DataSize = aValue2.DataSize then
           Result := CompareMem(aValue1.GetReferenceToRawData, aValue2.GetReferenceToRawData, aValue1.DataSize)
         else
           Result := False;
-      end
-      else
-        Result := False;
+      end;
+      tkVariant:  Result:=(aValue1.AsVariant=aValue2.AsVariant);
     end;
   end else
     Result := False;