Skip to content

Why is Change never reported? #107

@walles

Description

@walles

Hi!

I tried adding the below test case to diffable_impls/collection.rs.

But I'm getting Insert() + Remove() rather than Change() and the test fails.

If I wanted Change() to be reported here instead, what would be the easiest way for me to achieve that?

Or is this an unrealistic expectation? I'm bad at this.

    #[test]
    fn diff_change() {
        use super::Diffable;

        let left = b"YES".to_vec();
        let right = b"YAS".to_vec();

        let diff = left.diff(&right);
        if let edit::Edit::Change(diff) = diff {
            use collection::Edit::*;

            assert_eq!(
                diff.into_iter().collect::<Vec<_>>(),
                vec![
                    Copy(&b'Y'),
                    Change((&b'E', &b'A')),
                    Copy(&b'S'),
                ]
            );
        } else {
            unreachable!()
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions