diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-25 17:49:35 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-26 00:20:05 +0900 |
| commit | d4ec1dcb6fc04ff029ded35cc2fcc14f3bbc02ad (patch) | |
| tree | 0a85bd085961fcdfd5570cafc3b44ba5eb8cb152 /crates/shirabe/src/package/version/version_bumper.rs | |
| parent | 22d0b327368e5f39de6f381046c081d08efdba15 (diff) | |
| download | php-shirabe-d4ec1dcb6fc04ff029ded35cc2fcc14f3bbc02ad.tar.gz php-shirabe-d4ec1dcb6fc04ff029ded35cc2fcc14f3bbc02ad.tar.zst php-shirabe-d4ec1dcb6fc04ff029ded35cc2fcc14f3bbc02ad.zip | |
test: port 32 command/repository/downloader tests
Add create_installed_json/create_composer_lock test helpers. Port command (8),
repository path/forgejo/perforce/vcs (11), and fossil/hg/download_manager (13)
tests. Fix production porting bugs: root_package_loader/forgejo_url/version_bumper
regex delimiters, repository_manager create_repository_by_class, array_loader
isset, licenses_command RefCell borrow; implement disk_free_space and
touch2/touch3 via libc.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/package/version/version_bumper.rs')
| -rw-r--r-- | crates/shirabe/src/package/version/version_bumper.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/shirabe/src/package/version/version_bumper.rs b/crates/shirabe/src/package/version/version_bumper.rs index c029e3b..4deb450 100644 --- a/crates/shirabe/src/package/version/version_bumper.rs +++ b/crates/shirabe/src/package/version/version_bumper.rs @@ -54,9 +54,17 @@ impl VersionBumper { return Ok(pretty_constraint); } + // Regex pattern compatibility: + // PHP uses zero-width look-behind `(?<=,|\ |\||^)` and look-ahead `(?=,|$|\ |\||@)` to require + // a separator around the constraint. The `regex` crate supports neither, so the separators are + // matched as *consuming* groups instead. Only the `constraint` named group's own offset/length + // is used for the replacement below (never group 0), so consuming the surrounding separators + // does not shift the rewrite. The single-character `|`/space/comma separators are not consumed + // by both an adjacent trailing and leading match, but Composer never packs two same-major + // constraints around a single such separator (alternatives use `||`, ranges use spaces). let pattern = format!( r#"{{ - (?<=,|\ |\||^) # leading separator + (?:^|[,\ |]) # leading separator (?P<constraint> \^v?{major}(?:\.\d+)* # e.g. ^2.anything | ~v?{major}(?:\.\d+){{1,3}} # e.g. ~2.2 or ~2.2.2 or ~2.2.2.2 @@ -64,7 +72,7 @@ impl VersionBumper { | >=v?\d(?:\.\d+)* # e.g. >=2 or >=1.2 etc | \* # full wildcard ) - (?=,|$|\ |\||@) # trailing separator + (?:$|[,\ |@]) # trailing separator }}x"#, major = major ); |
