diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-22 23:42:07 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-22 23:42:07 +0900 |
| commit | 5ab5f3b316798c1411ce8e6a7f5b091fda93589c (patch) | |
| tree | c7669f94f5d9bd9adc07bc1aab3f14cfdec1ae5f /crates/shirabe/tests/util/package_sorter_test.rs | |
| parent | b291e714bc739262140323e08fe2fb9e91e00ee7 (diff) | |
| download | php-shirabe-5ab5f3b316798c1411ce8e6a7f5b091fda93589c.tar.gz php-shirabe-5ab5f3b316798c1411ce8e6a7f5b091fda93589c.tar.zst php-shirabe-5ab5f3b316798c1411ce8e6a7f5b091fda93589c.zip | |
test: port previously-ignored Composer tests via __ test hatches
Re-evaluate the reason'd #[ignore] tests under the Phase D criterion:
a test is unportable ONLY if the APIs/types needed to WRITE it do not
exist. A test that compiles but panics at runtime (todo!() body, a
regex the regex crate cannot compile) or fails at runtime (incomplete
or incorrect impl behavior) is portable -- it is written in full and
marked with a reason-less #[ignore].
About 120 test functions move from reason'd #[ignore] to reason-less
#[ignore] (the ported-but-not-yet-passing signal). Impl crates gain
only additive __ test hatches (init_command, pool, file_downloader,
package handle link setters, artifact/path repository, repository
manager, svn); no existing logic changes. Tests whose required APIs
genuinely do not exist (mock/reflection harness, ApplicationTester,
solve() discarding SolverProblemsException, a script::Event that
cannot be passed as an originating event) keep their reason'd
#[ignore].
cargo check -p shirabe --tests passes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/util/package_sorter_test.rs')
| -rw-r--r-- | crates/shirabe/tests/util/package_sorter_test.rs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/crates/shirabe/tests/util/package_sorter_test.rs b/crates/shirabe/tests/util/package_sorter_test.rs index f84ff09..0a8d395 100644 --- a/crates/shirabe/tests/util/package_sorter_test.rs +++ b/crates/shirabe/tests/util/package_sorter_test.rs @@ -1,30 +1,30 @@ //! ref: composer/tests/Composer/Test/Util/PackageSorterTest.php use indexmap::IndexMap; -use shirabe::package::handle::PackageInterfaceHandle; -use shirabe::package::loader::array_loader::ArrayLoader; +use shirabe::package::Link; +use shirabe::package::handle::{PackageHandle, PackageInterfaceHandle}; use shirabe::util::package_sorter::PackageSorter; -use shirabe_php_shim::PhpMixed; +use shirabe_semver::constraint::MatchAllConstraint; -/// PHP `createPackage` sets requires directly on a `Package`; the public handle API only allows -/// link setters on root packages, so the equivalent here builds the package through ArrayLoader. fn create_package(name: &str, requires: &[&str]) -> PackageInterfaceHandle { - let mut config: IndexMap<String, PhpMixed> = IndexMap::new(); - config.insert("name".to_string(), PhpMixed::String(name.to_string())); - config.insert("version".to_string(), PhpMixed::String("1.0.0".to_string())); + let package = PackageHandle::new(name.to_string(), "1.0.0.0".to_string(), "1.0.0".to_string()); - if !requires.is_empty() { - let mut links: IndexMap<String, PhpMixed> = IndexMap::new(); - for require_name in requires { - links.insert(require_name.to_string(), PhpMixed::String("*".to_string())); - } - config.insert("require".to_string(), PhpMixed::Array(links)); + let mut links: IndexMap<String, Link> = IndexMap::new(); + for require_name in requires { + links.insert( + require_name.to_string(), + Link::new( + package.get_name(), + require_name.to_string(), + MatchAllConstraint::new(None).into(), + None, + "*".to_string(), + ), + ); } + package.__set_requires(links); - ArrayLoader::new(None, false) - .load_packages(vec![config]) - .unwrap() - .remove(0) + package.into() } fn names(packages: &[PackageInterfaceHandle]) -> Vec<String> { @@ -141,7 +141,7 @@ fn sorting_orders_dependencies_higher_than_package_cases() -> Vec<( } #[test] -#[ignore = "constraint parsing reaches a look-around regex unsupported by the regex-crate shim (Preg)"] +#[ignore] fn test_sorting_orders_dependencies_higher_than_package() { for (packages, expected_ordered_list, weights) in sorting_orders_dependencies_higher_than_package_cases() |
