aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/downloader/git_downloader_test.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-17 18:22:54 +0900
committernsfisis <nsfisis@gmail.com>2026-07-17 18:22:54 +0900
commit6aa4808a0936e85384100f13e07aa7bea559bc3c (patch)
treefe2c3008fce0825a8d74c37588ce8bece91e3df3 /crates/shirabe/tests/downloader/git_downloader_test.rs
parente44085eb742cb14dff22de054ef19fe725a4e2c2 (diff)
downloadphp-shirabe-6aa4808a0936e85384100f13e07aa7bea559bc3c.tar.gz
php-shirabe-6aa4808a0936e85384100f13e07aa7bea559bc3c.tar.zst
php-shirabe-6aa4808a0936e85384100f13e07aa7bea559bc3c.zip
refactor(tests-async): unify duplicated tokio runtime bridges
11 downloader/installer integration-test files each redefined an identical current_thread `run()` helper to block on async code. Extract one shared multi_thread Runtime into tests/common/async_runtime.rs so concurrent #[test] threads can all block_on it, matching the direction item 7 (top-level Runtime) will take in production code.
Diffstat (limited to 'crates/shirabe/tests/downloader/git_downloader_test.rs')
-rw-r--r--crates/shirabe/tests/downloader/git_downloader_test.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/crates/shirabe/tests/downloader/git_downloader_test.rs b/crates/shirabe/tests/downloader/git_downloader_test.rs
index a73958b4..d4f40b77 100644
--- a/crates/shirabe/tests/downloader/git_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/git_downloader_test.rs
@@ -1,5 +1,6 @@
//! ref: composer/tests/Composer/Test/Downloader/GitDownloaderTest.php
+use crate::async_runtime::run;
use crate::config_stub::ConfigStubBuilder;
use crate::io_mock::{Expectation, get_io_mock};
use crate::io_stub::IOStub;
@@ -20,13 +21,6 @@ use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
use tempfile::TempDir;
-fn run<F: std::future::Future>(future: F) -> F::Output {
- tokio::runtime::Builder::new_current_thread()
- .build()
- .unwrap()
- .block_on(future)
-}
-
fn set_up() -> TempDir {
// skipIfNotExecutable('git') is irrelevant because every git invocation is mocked.