From d4ec1dcb6fc04ff029ded35cc2fcc14f3bbc02ad Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 25 Jun 2026 17:49:35 +0900 Subject: 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) --- crates/shirabe/tests/repository/path_repository_test.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/tests/repository/path_repository_test.rs') diff --git a/crates/shirabe/tests/repository/path_repository_test.rs b/crates/shirabe/tests/repository/path_repository_test.rs index 5679c38..bbf4938 100644 --- a/crates/shirabe/tests/repository/path_repository_test.rs +++ b/crates/shirabe/tests/repository/path_repository_test.rs @@ -7,6 +7,8 @@ use indexmap::IndexMap; use shirabe::config::Config; use shirabe::io::{IOInterface, NullIO}; use shirabe::repository::PathRepository; +use shirabe::util::http_downloader::HttpDownloader; +use shirabe::util::r#loop::Loop; use shirabe::util::{Platform, ProcessExecutor}; use shirabe_php_shim::{ DIRECTORY_SEPARATOR, PhpMixed, file_get_contents, hash, realpath, serialize, @@ -28,6 +30,16 @@ fn create_path_repo(options: IndexMap) -> PathRepository { let config = Rc::new(RefCell::new(Config::new(true, None))); let proc = Rc::new(RefCell::new(ProcessExecutor::new(None))); + // ref: createPathRepo wires the ProcessExecutor through a Loop so the VersionGuesser's async + // git calls are permitted; constructing the Loop calls enable_async() on the shared executor. + let http_downloader = Rc::new(RefCell::new(HttpDownloader::new( + io.clone(), + config.clone(), + IndexMap::new(), + false, + ))); + let _loop = Loop::new(http_downloader, Some(proc.clone())); + PathRepository::new(options, io, config, None, None, Some(proc)).unwrap() } @@ -68,7 +80,6 @@ fn test_load_package_from_file_system_with_version() { ); } -#[ignore = "version guessing for an unversioned package calls VersionGuesser::guess_git_version, which reaches stream_set_blocking (fcntl(2) not implemented, todo!()) and aborts the process"] #[test] fn test_load_package_from_file_system_without_version() { let repository_url = [ @@ -90,7 +101,6 @@ fn test_load_package_from_file_system_without_version() { assert!(!package_version.is_empty()); } -#[ignore = "the without-version fixture matched by the wildcard triggers VersionGuesser::guess_git_version, which reaches stream_set_blocking (fcntl(2) not implemented, todo!()) and aborts the process"] #[test] fn test_load_package_from_file_system_with_wildcard() { let repository_url = @@ -197,7 +207,6 @@ fn test_url_remains_relative() { assert_eq!(Some(relative_url), package.get_dist_url()); } -#[ignore = "the wildcard url also matches the without-version fixture, whose version guessing reaches stream_set_blocking (fcntl(2) not implemented, todo!()) and aborts the process"] #[test] fn test_reference_none() { let options = coordinates(vec![("reference", PhpMixed::String("none".to_string()))]); @@ -216,7 +225,6 @@ fn test_reference_none() { } } -#[ignore = "the wildcard url also matches the without-version fixture, whose version guessing reaches stream_set_blocking (fcntl(2) not implemented, todo!()) and aborts the process"] #[test] fn test_reference_config() { let options = coordinates(vec![ -- cgit v1.3.1