| 1 | // Upstream diff-match-patch's test suite is imported as unit tests in |
| 2 | // src/tests.rs, as they test APIs which are private in the Rust implementation. |
| 3 | // |
| 4 | // This directory is for Rust-specific integration tests and regression tests. |
| 5 | |
| 6 | use dissimilar::{diff, Chunk}; |
| 7 | |
| 8 | #[test] |
| 9 | fn test_unicode() { |
| 10 | // Unicode snowman and unicode comet have the same first two bytes. A |
| 11 | // byte-based diff would produce a 2-byte Equal followed by 1-byte Delete |
| 12 | // and Insert. |
| 13 | let snowman = "\u{2603}"; |
| 14 | let comet = "\u{2604}"; |
| 15 | assert_eq!(snowman.as_bytes()[..2], comet.as_bytes()[..2]); |
| 16 | |
| 17 | let d = diff(snowman, comet); |
| 18 | assert_eq!(d, vec![Chunk::Delete(snowman), Chunk::Insert(comet)]); |
| 19 | } |