aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/repository
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-21 04:18:23 +0900
committernsfisis <nsfisis@gmail.com>2026-06-21 04:18:23 +0900
commitc32165de121a823b9dfb0a3073d4f971f0d44e35 (patch)
treeb47f72f2c28289e52edfe26170a59b0a2d9161af /crates/shirabe/tests/repository
parent9d6603239643075f5962d9496ecce9c7a8730c52 (diff)
downloadphp-shirabe-c32165de121a823b9dfb0a3073d4f971f0d44e35.tar.gz
php-shirabe-c32165de121a823b9dfb0a3073d4f971f0d44e35.tar.zst
php-shirabe-c32165de121a823b9dfb0a3073d4f971f0d44e35.zip
test: port HgDriverTest and RootAliasPackageTest
HgDriver::supports and RootAliasPackage setRequires pass. The other Hg cases need an HgDriver instance (HttpDownloader/curl, mocked process); the other RootAliasPackage setters only update alias_of, not the alias's own copy, so those getters stay empty. All such cases ignored. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/repository')
-rw-r--r--crates/shirabe/tests/repository/vcs/hg_driver_test.rs49
-rw-r--r--crates/shirabe/tests/repository/vcs/mod.rs1
2 files changed, 50 insertions, 0 deletions
diff --git a/crates/shirabe/tests/repository/vcs/hg_driver_test.rs b/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
index 30be485..d7ff5c3 100644
--- a/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
@@ -1 +1,50 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/HgDriverTest.php
+
+use std::cell::RefCell;
+use std::rc::Rc;
+
+use shirabe::config::Config;
+use shirabe::io::IOInterface;
+use shirabe::io::null_io::NullIO;
+use shirabe::repository::vcs::HgDriver;
+
+fn supports_data_provider() -> Vec<&'static str> {
+ vec![
+ "ssh://bitbucket.org/user/repo",
+ "ssh://hg@bitbucket.org/user/repo",
+ "ssh://user@bitbucket.org/user/repo",
+ "https://bitbucket.org/user/repo",
+ "https://user@bitbucket.org/user/repo",
+ ]
+}
+
+#[test]
+fn test_supports() {
+ for repository_url in supports_data_provider() {
+ let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let config = Rc::new(RefCell::new(Config::new(true, None)));
+
+ assert!(HgDriver::supports(io, config, repository_url, false).unwrap());
+ }
+}
+
+// The remaining cases construct an HgDriver, which requires an HttpDownloader
+// (curl_multi_init is todo!() in the php-shim) and a mocked ProcessExecutor to feed
+// hg command output, neither of which is available here.
+#[test]
+#[ignore = "needs an HgDriver instance (HttpDownloader reaches curl_multi_init, todo!()) and a mocked ProcessExecutor"]
+fn test_get_branches_filter_invalid_branch_names() {
+ todo!()
+}
+
+#[test]
+#[ignore = "needs an HgDriver instance (HttpDownloader reaches curl_multi_init, todo!()) and a mocked ProcessExecutor"]
+fn test_file_get_content_invalid_identifier() {
+ todo!()
+}
+
+#[test]
+#[ignore = "needs an HgDriver instance (HttpDownloader reaches curl_multi_init, todo!()) and a mocked ProcessExecutor"]
+fn test_get_change_date_invalid_identifier() {
+ todo!()
+}
diff --git a/crates/shirabe/tests/repository/vcs/mod.rs b/crates/shirabe/tests/repository/vcs/mod.rs
index 44958da..474f388 100644
--- a/crates/shirabe/tests/repository/vcs/mod.rs
+++ b/crates/shirabe/tests/repository/vcs/mod.rs
@@ -1 +1,2 @@
mod fossil_driver_test;
+mod hg_driver_test;