VSoftTechnologies / DUnitX

Delphi Unit Test Framework
Apache License 2.0
383 stars 199 forks source link

Assert.AreEqual<T> needs to become smarter of picking a comparer #167

Open jpluimers opened 7 years ago

jpluimers commented 7 years ago

Right now Assert.AreEqual<T> takes the easy way out (probably the Delphi RTL takes the easy way out as well) by using TComparer<T>.Default.

This happens for any dynamic array (I'm working for a fix on that) or any record type having reference fields in it for instance on this:

  TRecordWithReferences = record
    Value: Integer;
    Reference: string;
  end;

The intrinsic Copy in the System unit is smarter and ends up in methods like _CopyArray and __CopyRecord to do the actual deep copy.

It would be nice (but a lot of work) to do something similar for DUnitX on the comparison level.

vincentparrett commented 7 years ago

Happy to accept a PR for this, I don't have the time to implement it myself right now.