diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-04 10:35:58 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-04 10:35:58 +0900 |
| commit | 1427c101f98c72e551fcc72671ab3cde0991bb6d (patch) | |
| tree | b83fe05cc22a38813243d86890fde34721b7985a /crates/mozart-registry | |
| parent | bc72b70daea7db03456508540f96ab6f019ef5e3 (diff) | |
| download | php-mozart-1427c101f98c72e551fcc72671ab3cde0991bb6d.tar.gz php-mozart-1427c101f98c72e551fcc72671ab3cde0991bb6d.tar.zst php-mozart-1427c101f98c72e551fcc72671ab3cde0991bb6d.zip | |
test(resolver): scaffold PoolBuilder fixture suite from Composer
Port the 31 .test fixtures under
composer/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder/
as #[ignore]'d cases in mozart-registry/tests/poolbuilder.rs. Each
fixture is parsed eagerly so format-level regressions surface
immediately, while the runner itself is unimplemented\!() — removing
#[ignore] from a case will force the missing pool-build entry point
into existence rather than silently mis-run. Generalize
mozart-test-harness's split_sections to take a per-format valid-section
list and add a poolbuilder parser alongside the installer one.
Diffstat (limited to 'crates/mozart-registry')
| -rw-r--r-- | crates/mozart-registry/Cargo.toml | 3 | ||||
| -rw-r--r-- | crates/mozart-registry/tests/poolbuilder.rs | 80 |
2 files changed, 83 insertions, 0 deletions
diff --git a/crates/mozart-registry/Cargo.toml b/crates/mozart-registry/Cargo.toml index 10eaf3b..6816e8d 100644 --- a/crates/mozart-registry/Cargo.toml +++ b/crates/mozart-registry/Cargo.toml @@ -26,3 +26,6 @@ tempfile.workspace = true tokio.workspace = true tracing.workspace = true zip.workspace = true + +[dev-dependencies] +mozart-test-harness.workspace = true diff --git a/crates/mozart-registry/tests/poolbuilder.rs b/crates/mozart-registry/tests/poolbuilder.rs new file mode 100644 index 0000000..d8511e4 --- /dev/null +++ b/crates/mozart-registry/tests/poolbuilder.rs @@ -0,0 +1,80 @@ +//! Pool-builder fixture suite, ported from +//! `composer/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php`. +//! +//! Composer drives this suite through a `@dataProvider`; each `.test` file +//! becomes one parameterized case. Mirrored here as one `#[test]` per +//! fixture so the count surfaces in `cargo test` output and individual +//! cases can be re-enabled as the runner is fleshed out. +//! +//! Every test is currently `#[ignore]` because the runner is a stub: the +//! orchestration that takes a `RepositorySet` + `Request` and produces a +//! populated `Pool` lives inline in `mozart_registry::resolver::resolve`, +//! not as an extracted entry point. Wiring those up — alias handling, +//! stability flags, fixed/locked packages, the optimizer pass — is the +//! follow-up work this scaffolding exists to track. + +use std::path::{Path, PathBuf}; + +use mozart_test_harness::{ParsedPoolBuilderTest, parse_pool_builder_test_file}; + +fn fixtures_dir() -> PathBuf { + Path::new(env!("CARGO_MANIFEST_DIR")) + .join("../../composer/tests/Composer/Test/DependencyResolver/Fixtures/poolbuilder") +} + +fn run_poolbuilder_fixture(ident: &str) { + let filename = format!("{}.test", ident.replace('_', "-")); + let path = fixtures_dir().join(&filename); + let _parsed: ParsedPoolBuilderTest = parse_pool_builder_test_file(&path) + .unwrap_or_else(|e| panic!("failed to parse {}: {:#}", path.display(), e)); + + // Runner is intentionally not implemented yet — see module docs. + // Removing `#[ignore]` from a case will surface this `unimplemented!` + // and force the missing pool-builder entry point into existence. + unimplemented!( + "PoolBuilderTest runner not yet wired up; cannot execute {}", + path.display() + ); +} + +macro_rules! poolbuilder_fixture { + ($name:ident) => { + #[test] + #[ignore] + fn $name() { + run_poolbuilder_fixture(stringify!($name)); + } + }; +} + +poolbuilder_fixture!(alias_priority_conflicting); +poolbuilder_fixture!(alias_with_reference); +poolbuilder_fixture!(constraint_expansion_works_with_exact_versions); +poolbuilder_fixture!(filter_impossible_packages); +poolbuilder_fixture!(filter_impossible_packages_locked_replacer); +poolbuilder_fixture!(filter_impossible_packages_only_required); +poolbuilder_fixture!(filter_impossible_packages_only_required_provides); +poolbuilder_fixture!(filter_impossible_packages_only_required_replaces); +poolbuilder_fixture!(filter_impossible_packages_provides); +poolbuilder_fixture!(filter_impossible_packages_replaces); +poolbuilder_fixture!(fixed_packages_do_not_load_from_repos); +poolbuilder_fixture!(fixed_packages_replaced_do_not_load_from_repos); +poolbuilder_fixture!(load_replaced_package_if_replacer_dropped); +poolbuilder_fixture!(load_replaced_root_package_if_replacer_dropped); +poolbuilder_fixture!(multi_repo_replace); +poolbuilder_fixture!(multi_repo_replace_partial_update_all); +poolbuilder_fixture!(must_expand_root_reqs); +poolbuilder_fixture!(package_versions_are_not_loaded_if_not_required_expansion); +poolbuilder_fixture!(package_versions_are_not_loaded_if_not_required_recursive); +poolbuilder_fixture!(packages_that_do_not_exist); +poolbuilder_fixture!(partial_update); +poolbuilder_fixture!(partial_update_transitive_deps_no_root_unfix); +poolbuilder_fixture!(partial_update_transitive_deps_unfix); +poolbuilder_fixture!(partial_update_unfixes_path_repo_replacer_with_transitive_deps); +poolbuilder_fixture!(partial_update_unfixes_path_repos_always_but_not_their_transitive_deps); +poolbuilder_fixture!(partial_update_unfixing_locked_deps); +poolbuilder_fixture!(partial_update_unfixing_replacers); +poolbuilder_fixture!(partial_update_unfixing_with_replacers); +poolbuilder_fixture!(partial_update_unfixing_with_replacers_providers); +poolbuilder_fixture!(root_requirements_avoid_loading_further_versions); +poolbuilder_fixture!(stability_flags_take_over_minimum_stability_and_filter_packages); |
