Diffing string checker

Horacio Duran horacio.duran at canonical.com
Thu Feb 25 09:13:48 UTC 2016


You are my new personal hero

On Thursday, 25 February 2016, Andrew Wilkins <andrew.wilkins at canonical.com>
wrote:

> Howdy,
>
> Occasionally I'll change a test, and some string equality test will fail
> with a wall of text. Sometimes we shouldn't be checking the whole string,
> but sometimes it's legitimate to do so, and it can be difficult/tedious to
> spot the differences.
>
> I've just written a checker which diffs the two string args, and
> colourises the output. You may find it useful. I'm using red/green
> background, but I also added bold for insertions, strike-through for
> deletions, in case you're red/green colour blind. My terminal doesn't do
> strike-through, and your's probably doesn't either. Anyway, the important
> thing is you can see the difference between bits that are the same vs.
> insertions/deletions.
>
> Code is at github.com/axw/fancycheck. Just replace
>     c.Assert("x", gc.Equals, "y")
> with
>     c.Assert("x", fancycheck.StringEquals, "y")
>
> Cheers,
> Andrew
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20160225/1a74bed4/attachment.html>


More information about the Juju-dev mailing list