MCPcopy Create free account
hub / github.com/distil/diffus / string

Function string

diffus/src/diffable_impls/string.rs:43–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41
42 #[test]
43 fn string() {
44 use super::Diffable;
45
46 let left = "XMJYAUZ".to_owned();
47 let right = "MZJAWXU".to_owned();
48
49 let diff = left.diff(&right);
50 if let edit::Edit::Change(diff) = diff {
51 assert_eq!(
52 diff.into_iter().collect::<Vec<_>>(),
53 vec![
54 string::Edit::Remove('X'),
55 string::Edit::Copy('M'),
56 string::Edit::Insert('Z'),
57 string::Edit::Copy('J'),
58 string::Edit::Remove('Y'),
59 string::Edit::Copy('A'),
60 string::Edit::Insert('W'),
61 string::Edit::Insert('X'),
62 string::Edit::Copy('U'),
63 string::Edit::Remove('Z')
64 ]
65 );
66 } else {
67 unreachable!()
68 }
69 }
70
71 #[test]
72 fn str() {

Callers

nothing calls this directly

Calls 1

diffMethod · 0.45

Tested by

no test coverage detected