testdiff

Simple utility for diffing values in tests.

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-24 13:02

Installation

nimble install testdiff
choosenim install testdiff
git clone https://github.com/geotre/testdiff

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
testdiff - - - - - - -

Source

Repository https://github.com/geotre/testdiff
Homepage https://github.com/geotre/testdiff
Registry Source nimble_official

README

testdiff

A simple utility for diffing in tests.

nimble install testdiff


Tested on Nim versions 1.6, stable, and devel.

Github Actions

Usage

See example for basic usage, test example for a simple test structure.

import pkg/testdiff

type
  Node = ref object
    val: int
    children: seq[Node]

let
  treeA = Node(val: 3, children: @[Node(val: 5)])
  treeB = Node(val: 3, children: @[Node(val: 7)])

echo $diffObjects(treeA, treeB)

difference at path children[0].val: 5 != 7 (int)

Motivation

I recently found myself writing tests that compare the result object of a library procedure with a manually-instantiated object. It is easy for a test to say these objects don't match but you don't get more details than that, which can be challenging if the difference is a single field in a large (potentially nested) object. This library allows you to easily show where the mismatch is found.