Skip to main content

diff_lines

Function diff_lines 

Source
pub fn diff_lines(expected: &str, actual: &str) -> String
Expand description

Renders a line-oriented diff between expected and actual.

The result has no trailing newline, so it composes when the renderer indents each line.

use test_better_core::TestResult;
use test_better_matchers::{diff_lines, eq, check};

fn main() -> TestResult {
    let diff = diff_lines("a\nb\nc", "a\nB\nc");
    check!(diff).satisfies(eq(" a\n-b\n+B\n c".to_string()))?;
    Ok(())
}