Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is Change never reported? #107

Open
walles opened this issue Aug 14, 2023 · 0 comments
Open

Why is Change never reported? #107

walles opened this issue Aug 14, 2023 · 0 comments

Comments

@walles
Copy link

walles commented Aug 14, 2023

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!()
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant