Skip to content

A diff+assertion library for Facet types

Notifications You must be signed in to change notification settings

bearcove/rediff

Repository files navigation

rediff

Structural diffing and assertions for Facet types.

Compare any Facet-derived type without requiring PartialEq - rediff uses reflection to compare values structurally and produce detailed, colorized diff output.

Features

  • Structural comparison without PartialEq
  • Pretty assert_same! and assert_sameish! macros for testing
  • Multi-format rendering (Rust, JSON, XML styles)
  • ANSI colored terminal output
  • Myers' algorithm for sequence diffing

Installation

cargo add rediff

Usage

Assertions in tests

use facet::Facet;
use rediff::assert_same;

#[derive(Facet)]
struct Point { x: i32, y: i32 }

let a = Point { x: 10, y: 20 };
let b = Point { x: 10, y: 20 };
assert_same!(a, b);

Diffing values

use facet::Facet;
use rediff::{FacetDiff, format_diff_default};

#[derive(Facet)]
struct Config {
    host: String,
    port: u16,
}

let old = Config { host: "localhost".into(), port: 8080 };
let new = Config { host: "localhost".into(), port: 9000 };

let diff = old.diff(&new);
println!("{}", format_diff_default(&diff));

About

A diff+assertion library for Facet types

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages