-
Notifications
You must be signed in to change notification settings - Fork 909
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use diffy::{self, create_patch}; | ||
|
||
#[test] | ||
fn diffy_test_diff() { | ||
let original = "The quick brown fox jumps over the lazy dog"; | ||
let modified = "The quick brown fox jumps over the LAZY dog"; | ||
|
||
let patch = create_patch(original, modified); | ||
// diffy uses hunks which indicates the lines that are different | ||
assert_eq!(patch.hunks().is_empty(), false); | ||
// hence regardless, patch.to_string() will never be empty | ||
assert_eq!(patch.to_string().is_empty(), false); | ||
} | ||
|
||
#[test] | ||
fn diffy_test_no_diff() { | ||
let original = "The quick brown fox jumps over the lazy dog"; | ||
|
||
let patch = create_patch(original, original); | ||
assert_eq!(patch.hunks().is_empty(), true); | ||
assert_eq!(patch.to_string().is_empty(), false); | ||
} |