test(compat): add GNU patch compatibility tests#56
Open
weihanglo wants to merge 6 commits intobmwill:masterfrom
Open
test(compat): add GNU patch compatibility tests#56weihanglo wants to merge 6 commits intobmwill:masterfrom
weihanglo wants to merge 6 commits intobmwill:masterfrom
Conversation
70cbccf to
4587314
Compare
weihanglo
commented
Apr 10, 2026
| //! Compatibility tests against reference implementations. | ||
| //! | ||
| //! These tests verify diffy produces results compatible with established tools | ||
| //! Focus is on edge cases and ambiguous behavior, |
Contributor
Author
There was a problem hiding this comment.
Actually IMHO we should move most tests to compatible tests, if they are testing against some reference tool's behavior.
Preparation for multi-file patches support.
Preparation for multi-file patches support.
Rename patches module to patch_set and Patches struct to PatchSet. Replace boundary pre-scan with single-pass parse_one. Terminate iterator on parse error while allowing callers to continue. bmwill#55 (comment) bmwill#55 (comment) bmwill#55 (comment) bmwill#55 (comment)
We need to track lockfile because we want to make sure our CI using rayon@1.10.0. And I don't want to block whoever wants to use latest rayon to run tests. (Though that doesn't matter as dependent won't respect our lockfile) For other reasons, see * <https://blog.rust-lang.org/2023/08/29/committing-lockfiles/> * <https://doc.rust-lang.org/nightly/cargo/faq.html#why-have-cargolock-in-version-control> * <https://doc.rust-lang.org/nightly/cargo/reference/rust-version.html> Most importantly: > Verifying a minimum-supported Rust version (MSRV) > that is less than the latest version of a dependency supports And actually during the course, I found that `windows-link` requires Rust 1.71. `windows-link` is a transitive dependency of `anstyle` through `windows-sys`. Our MSRV is already a lie for windows user when enabling `color`. ``` console $ cargo generate-lockfile --config 'resolver.incompatible-rust-versions="fallback"' Updating crates.io index Locking 24 packages to latest Rust 1.70.0 compatible versions Adding snapbox v0.6.24 (available: v1.1.0) Adding windows-link v0.2.1 (requires Rust 1.71) ```
Tests verify diffy produces results compatible with reference tools. Here we have GNU patch. In the future we'll have `git apply`. We don't run reference tool locally, as user may not have the tool. To run it, set `env CI=1` and run the test. Please see the module level doc for more.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests verify diffy produces results compatible with reference tools.
Here we have GNU patch. In the future we'll have
git apply.We don't run reference tool locally, as user may not have the tool.
To run it, set
env CI=1and run the test.Please see the module level doc for more.