| 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 dissimilarrust-analyzer cargo dissimilar 1.0.2 crate/::{diffrust-analyzer cargo dissimilar 1.0.2 diff()., Chunkrust-analyzer cargo dissimilar 1.0.2 Chunk#}; |
| 7 | |
| 8 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 9 | fn test_unicoderust-analyzer cargo dissimilar 1.0.2 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_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(snowman.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., comet.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 16 | |
| 17 | let d = diffrust-analyzer cargo dissimilar 1.0.2 diff().(snowman, comet); |
| 18 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(d, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Chunkrust-analyzer cargo dissimilar 1.0.2 Chunk#::Deleterust-analyzer cargo dissimilar 1.0.2 Chunk#Delete#(snowman), Chunkrust-analyzer cargo dissimilar 1.0.2 Chunk#::Insertrust-analyzer cargo dissimilar 1.0.2 Chunk#Insert#(comet)]); |
| 19 | } |