d-edge / diffract Goto Github PK
View Code? Open in Web Editor NEWA .NET library to perform structural diff between two objects
License: MIT License
A .NET library to perform structural diff between two objects
License: MIT License
I have a data structure that contains a deeply nested NodaTime.LocalTime. The diff output is too detailed to be human-readable. I'd like to override the diff output for the LocalTime to show "hh:mm". Is there a way to achieve this?
I see that I can pass an IDiffer
to the diff function. But I only want a replacement for LocalTime
with as little effort as possible.
Thanks for this great library!
Hi!
We need to create guidelines to communicate how people should contribute to Diffract.
Here is the official doc about how to do this: https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors
Thank you!
Hello!
The logo is currently note visible.
Use icon in paket to get the icon on nuget. Note that icon is supported with NuGet 5.3.0 and above.
This change is an edit of paket.template. We can add a line with icon ..\diffract-64x64.png
. I think it should work.
Cheers,
The output for different strings just prints the two strings on separate lines. This is fine for short strings, but for longer ones, especially multiline, it can be difficult to find where exactly the difference is. We could take inspiration from other assertion libraries that indicate at which character position the strings begin to differ, and only print the section of the string around that position.
Hint for the person who wants to take up this issue: I think the best way to go would be to add a case String of x1: string * x2: string
to the type Diff
. This case would be used in Differ.diffWith
instead of simpleEquality
(which returns a Diff.Value
). Its display format would then be applied in DiffPrinter.toStreamImpl.
It seems targeting netfx (net472/net48 or netstandard2.0) would be doable without change.
That would no exclude previous framworks from working
It might be visually easier to compare the expected and actual output like this:
To reproduce
Diffract.Assert(true, false)
Actual
Diffract.AssertionFailedException: Expect = true
Actual = false
Expected
Diffract.AssertionFailedException
Expect = true
Actual = false
But not when there is a text after
Diffract.AssertionFailedException: ResultValue collection differs:
ResultValue[0].Item.Amount Expect = 101M
Actual = 10M
The goal would be to have a alignement between Expect and Actual.
C# seems to have odd behavior when trying to use a type whose name is the same as a namespace. Calling Diffract.Assert
poses no issue in the project's tests: they are inside the Diffract
namespace and therefore have the class Diffract.Diffract
in scope. But in a real-life project, using Diffract
doesn't work as well:
namespace MyNamespace;
using Diffract;
Diffract.Assert(1, 2);
// Error CS0234 : The type or namespace name 'Assert' does not exist in the namespace 'Diffract' (are you missing an assembly reference?)
The compiler thinks we're trying to use the namespace Diffract
when we're in fact trying to use the class Diffract
. The solution right now is to fully qualify the call:
Diffract.Diffract.Assert(1, 2);
But that's not very nice; we should fix this. It's okay to change the API, that's what version 0.x is for ๐
We have several options to remove the ambiguity:
Dedge.Diffract
.Differ
maybe? (we can put ModuleSuffix
on the existing F# module to avoid a duplicate definition)Hello,
Help us to create a logo for Diffract or vote for one. Also any icon idea is welcome :)
Cheers,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.