#diff #testing #test #file

file_diff

An atomic utility for diffing files in testing

3 releases (1 stable)

Uses old Rust 2015

1.0.0 Apr 10, 2016
0.2.0 Feb 1, 2015
0.1.0 Dec 23, 2014

#90 in Testing

Download history 7819/week @ 2021-06-30 9775/week @ 2021-07-07 6516/week @ 2021-07-14 7527/week @ 2021-07-21 8675/week @ 2021-07-28 9460/week @ 2021-08-04 5664/week @ 2021-08-11 9830/week @ 2021-08-18 10681/week @ 2021-08-25 7863/week @ 2021-09-01 13991/week @ 2021-09-08 9538/week @ 2021-09-15 6942/week @ 2021-09-22 9221/week @ 2021-09-29 9268/week @ 2021-10-06 6965/week @ 2021-10-13

24,558 downloads per month
Used in 11 crates (8 directly)

BSD-3-Clause

285KB
50 lines

File Diff

This module provides an atomic file diffing function for use in unit tests.

The diff_files() function takes two file handles and determines returns true if they point to identical files.

use file_diff::{diff_files};
use std::fs::{File};

let mut file1 = match File::open("./src/lib.rs") {
    Ok(f) => f,
    Err(e) => panic!("{}", e),
};
let mut file2 = match File::open("./src/lib.rs") {
    Ok(f) => f,
    Err(e) => panic!("{}", e),
};

diff_files(&mut file1, &mut file2);

The diff() function takes string representations of the files and returns true if the strings represent real files and those files are identical.

use file_diff::{diff};

diff("./src/lib.rs", "./src/lib.rs"); // true

lib.rs:

File Diff

This module provides an atomic file diffing function for use in unit tests.

The diff_files() function takes two file handles and determines returns true if they point to identical files.

use file_diff::{diff_files};
use std::fs::{File};

let mut file1 = match File::open("./src/lib.rs") {
    Ok(f) => f,
    Err(e) => panic!("{}", e),
};
let mut file2 = match File::open("./src/lib.rs") {
    Ok(f) => f,
    Err(e) => panic!("{}", e),
};

diff_files(&mut file1, &mut file2);

The diff() function takes string representations of the files and returns true if the strings represent real files and those files are identical.

use file_diff::{diff};

diff("./src/lib.rs", "./src/lib.rs");

No runtime deps