aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/repository/vcs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-22 02:09:59 +0900
committernsfisis <nsfisis@gmail.com>2026-06-22 02:09:59 +0900
commit822d9a872807a92a5337ee8b7bab96dc9845cdbb (patch)
tree4931365df5978caffade69cad2154718a9076f66 /crates/shirabe/tests/repository/vcs
parentf691b864b687f251c3b266e8cff2774d730567ba (diff)
downloadphp-shirabe-822d9a872807a92a5337ee8b7bab96dc9845cdbb.tar.gz
php-shirabe-822d9a872807a92a5337ee8b7bab96dc9845cdbb.tar.zst
php-shirabe-822d9a872807a92a5337ee8b7bab96dc9845cdbb.zip
test: port more test cases
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/repository/vcs')
-rw-r--r--crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs8
-rw-r--r--crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs10
-rw-r--r--crates/shirabe/tests/repository/vcs/git_driver_test.rs12
-rw-r--r--crates/shirabe/tests/repository/vcs/github_driver_test.rs18
-rw-r--r--crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs112
-rw-r--r--crates/shirabe/tests/repository/vcs/hg_driver_test.rs6
-rw-r--r--crates/shirabe/tests/repository/vcs/perforce_driver_test.rs39
-rw-r--r--crates/shirabe/tests/repository/vcs/svn_driver_test.rs2
8 files changed, 143 insertions, 64 deletions
diff --git a/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs b/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs
index a67bce3..0836fc5 100644
--- a/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs
@@ -93,7 +93,7 @@ fn test_supports() {
// Forgejo API responses; mocking is not available, and a real HttpDownloader reaches
// curl_multi_init (todo!()).
#[test]
-#[ignore = "constructs a ForgejoDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_public_repository() {
let SetUp {
home,
@@ -107,7 +107,7 @@ fn test_public_repository() {
}
#[test]
-#[ignore = "constructs a ForgejoDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_get_branches() {
let SetUp {
home,
@@ -121,7 +121,7 @@ fn test_get_branches() {
}
#[test]
-#[ignore = "constructs a ForgejoDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_get_tags() {
let SetUp {
home,
@@ -135,7 +135,7 @@ fn test_get_tags() {
}
#[test]
-#[ignore = "constructs a ForgejoDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_get_empty_file_content() {
let SetUp {
home,
diff --git a/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs b/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
index b6759b5..2fedba1 100644
--- a/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
@@ -103,7 +103,7 @@ fn test_supports() {
// Bitbucket API responses; mocking is not available, and a real HttpDownloader reaches
// curl_multi_init (todo!()).
#[test]
-#[ignore = "constructs a GitBitbucketDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "needs IOInterface mock (getMockBuilder) and getHttpDownloaderMock/HttpDownloaderMock (not ported); set_up()'s io and http_downloader are todo!() and real HttpDownloader hits todo!() curl I/O"]
fn test_get_root_identifier_wrong_scm_type() {
let SetUp {
home,
@@ -116,7 +116,7 @@ fn test_get_root_identifier_wrong_scm_type() {
}
#[test]
-#[ignore = "constructs a GitBitbucketDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "needs IOInterface mock (getMockBuilder) and getHttpDownloaderMock/HttpDownloaderMock (not ported); set_up()'s io and http_downloader are todo!() and real HttpDownloader hits todo!() curl I/O"]
fn test_driver() {
let SetUp {
home,
@@ -129,7 +129,7 @@ fn test_driver() {
}
#[test]
-#[ignore = "constructs a GitBitbucketDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "needs IOInterface mock (getMockBuilder) and getHttpDownloaderMock/HttpDownloaderMock (not ported); depends on test_driver's driver and set_up()'s todo!() mocks"]
fn test_get_params() {
let SetUp {
home,
@@ -142,7 +142,7 @@ fn test_get_params() {
}
#[test]
-#[ignore = "constructs a GitBitbucketDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "needs IOInterface mock (getMockBuilder) and getHttpDownloaderMock/HttpDownloaderMock (not ported); set_up()'s io and http_downloader are todo!()"]
fn test_initialize_invalid_repository_url() {
let SetUp {
home,
@@ -155,7 +155,7 @@ fn test_initialize_invalid_repository_url() {
}
#[test]
-#[ignore = "constructs a GitBitbucketDriver and mocks the HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "needs IOInterface mock (getMockBuilder) and getHttpDownloaderMock/HttpDownloaderMock (not ported); set_up()'s io and http_downloader are todo!() and real HttpDownloader hits todo!() curl I/O"]
fn test_invalid_support_data() {
let SetUp {
home,
diff --git a/crates/shirabe/tests/repository/vcs/git_driver_test.rs b/crates/shirabe/tests/repository/vcs/git_driver_test.rs
index 1aacbf9..56c2755 100644
--- a/crates/shirabe/tests/repository/vcs/git_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/git_driver_test.rs
@@ -64,7 +64,7 @@ impl Drop for TearDown {
}
#[test]
-#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "requires ProcessExecutor mock (getProcessExecutorMock/expects) and Reflection setRepoDir, neither available"]
fn test_get_root_identifier_from_remote_local_repository() {
let SetUp {
home,
@@ -76,7 +76,7 @@ fn test_get_root_identifier_from_remote_local_repository() {
}
#[test]
-#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "requires ProcessExecutor mock (getProcessExecutorMock/expects), IO mock and Reflection setRepoDir, none available"]
fn test_get_root_identifier_from_remote() {
let SetUp {
home,
@@ -88,7 +88,7 @@ fn test_get_root_identifier_from_remote() {
}
#[test]
-#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "requires ProcessExecutor mock (getProcessExecutorMock/expects) and Reflection setRepoDir, neither available"]
fn test_get_root_identifier_from_local_with_network_disabled() {
let SetUp {
home,
@@ -100,7 +100,7 @@ fn test_get_root_identifier_from_local_with_network_disabled() {
}
#[test]
-#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "requires ProcessExecutor mock (getProcessExecutorMock/expects), IOInterface mock and Reflection setRepoDir, none available"]
fn test_get_branches_filter_invalid_branch_names() {
let SetUp {
home,
@@ -112,7 +112,7 @@ fn test_get_branches_filter_invalid_branch_names() {
}
#[test]
-#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "requires ProcessExecutor mock (getProcessExecutorMock) and IOInterface/HttpDownloader mocks, none available"]
fn test_file_get_content_invalid_identifier() {
let SetUp {
home,
@@ -124,7 +124,7 @@ fn test_file_get_content_invalid_identifier() {
}
#[test]
-#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"]
+#[ignore = "requires ProcessExecutor mock (getProcessExecutorMock) and IOInterface/HttpDownloader mocks, none available"]
fn test_get_change_date_invalid_identifier() {
let SetUp {
home,
diff --git a/crates/shirabe/tests/repository/vcs/github_driver_test.rs b/crates/shirabe/tests/repository/vcs/github_driver_test.rs
index 3e97599..5313c0b 100644
--- a/crates/shirabe/tests/repository/vcs/github_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/github_driver_test.rs
@@ -84,7 +84,7 @@ fn test_supports() {
// GitHub API responses; mocking is not available, and a real HttpDownloader reaches
// curl_multi_init (todo!()).
#[test]
-#[ignore = "constructs a GitHubDriver and mocks the HttpDownloader/IO (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock), ProcessExecutorMock, the IOInterface MockObject (askAndHideAnswer/setAuthentication), and setAttribute reflection are not ported"]
fn test_private_repository() {
let SetUp { home, config: _ } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
@@ -92,7 +92,7 @@ fn test_private_repository() {
}
#[test]
-#[ignore = "constructs a GitHubDriver and mocks the HttpDownloader/IO (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock), ProcessExecutorMock, the IOInterface MockObject, and setAttribute reflection are not ported"]
fn test_public_repository() {
let SetUp { home, config: _ } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
@@ -100,7 +100,7 @@ fn test_public_repository() {
}
#[test]
-#[ignore = "constructs a GitHubDriver and mocks the HttpDownloader/IO (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock), ProcessExecutorMock, the IOInterface MockObject, and setAttribute reflection are not ported"]
fn test_public_repository2() {
let SetUp { home, config: _ } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
@@ -108,7 +108,7 @@ fn test_public_repository2() {
}
#[test]
-#[ignore = "constructs a GitHubDriver and mocks the HttpDownloader/IO (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock), ProcessExecutorMock, the IOInterface MockObject, and setAttribute reflection are not ported"]
fn test_invalid_support_data() {
let SetUp { home, config: _ } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
@@ -116,7 +116,7 @@ fn test_invalid_support_data() {
}
#[test]
-#[ignore = "constructs a GitHubDriver and mocks the HttpDownloader/IO (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock), ProcessExecutorMock, the IOInterface MockObject, setAttribute reflection, and the fundingUrlProvider data provider are not ported"]
fn test_funding_format() {
let SetUp { home, config: _ } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
@@ -124,7 +124,7 @@ fn test_funding_format() {
}
#[test]
-#[ignore = "constructs a GitHubDriver and mocks the HttpDownloader/IO (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock), ProcessExecutorMock, the IOInterface MockObject, and setAttribute reflection are not ported"]
fn test_public_repository_archived() {
let SetUp { home, config: _ } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
@@ -132,7 +132,7 @@ fn test_public_repository_archived() {
}
#[test]
-#[ignore = "constructs a GitHubDriver and mocks the HttpDownloader/IO (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock), ProcessExecutorMock, and the IOInterface MockObject are not ported"]
fn test_private_repository_no_interaction() {
let SetUp { home, config: _ } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
@@ -140,7 +140,7 @@ fn test_private_repository_no_interaction() {
}
#[test]
-#[ignore = "constructs a GitHubDriver and mocks the HttpDownloader/IO (curl_multi_init todo!())"]
+#[ignore = "IOInterface MockObject (getMockBuilder) and HttpDownloader MockObject (getMockBuilder) plus the invalidUrlProvider data provider are not ported"]
fn test_initialize_invalid_repo_url() {
let SetUp { home, config: _ } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
@@ -148,7 +148,7 @@ fn test_initialize_invalid_repo_url() {
}
#[test]
-#[ignore = "constructs a GitHubDriver and mocks the HttpDownloader/IO (curl_multi_init todo!())"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock), ProcessExecutorMock, and the IOInterface MockObject are not ported"]
fn test_get_empty_file_content() {
let SetUp { home, config: _ } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
diff --git a/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs b/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs
index 1e13ada..0333a2b 100644
--- a/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs
@@ -1,107 +1,177 @@
//! ref: composer/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php
-// All cases either mock the HttpDownloader/IO to return GitLab API responses (a real
-// HttpDownloader reaches curl_multi_init, todo!()), or — for testSupports — rely on the
-// gitlab-domains configured in setUp plus the openssl extension, which are not modeled.
+use std::cell::RefCell;
+use std::rc::Rc;
+
+use indexmap::IndexMap;
+use shirabe::config::Config;
+use shirabe::io::IOInterface;
+use shirabe::io::null_io::NullIO;
+use shirabe::repository::vcs::GitLabDriver;
+use shirabe_php_shim::{PhpMixed, extension_loaded};
+
+// Mirrors GitLabDriverTest::setUp's `gitlab-domains` configuration.
+fn make_config() -> Config {
+ let mut config = Config::new(true, None);
+ let mut top: IndexMap<String, PhpMixed> = IndexMap::new();
+ let mut config_section: IndexMap<String, PhpMixed> = IndexMap::new();
+ config_section.insert(
+ "gitlab-domains".to_string(),
+ PhpMixed::List(vec![
+ PhpMixed::String("mycompany.com/gitlab".to_string()),
+ PhpMixed::String("gitlab.mycompany.com".to_string()),
+ PhpMixed::String("othercompany.com/nested/gitlab".to_string()),
+ PhpMixed::String("gitlab.com".to_string()),
+ PhpMixed::String("gitlab.mycompany.local".to_string()),
+ ]),
+ );
+ top.insert("config".to_string(), PhpMixed::Array(config_section));
+ config.merge(&top, Config::SOURCE_UNKNOWN);
+ config
+}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_initialize() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_initialize_public_project() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_initialize_public_project_as_anonymous() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_initialize_with_port_number() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "depends on testInitialize, which needs HttpDownloaderMock + setAttribute (\\ReflectionProperty) not ported"]
fn test_invalid_support_data() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "depends on testInitialize, which needs HttpDownloaderMock + the IOInterface MockObject not ported"]
fn test_get_dist() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "depends on testInitialize, which needs HttpDownloaderMock + the IOInterface MockObject not ported"]
fn test_get_source() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "depends on testInitializePublicProject, which needs HttpDownloaderMock + the IOInterface MockObject not ported"]
fn test_get_source_given_public_project() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "depends on testInitialize, which needs HttpDownloaderMock + the IOInterface MockObject not ported"]
fn test_get_tags() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "depends on testInitialize, which needs HttpDownloaderMock + the IOInterface MockObject not ported"]
fn test_get_paginated_refs() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "depends on testInitialize, which needs HttpDownloaderMock + the IOInterface MockObject not ported"]
fn test_get_branches() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore]
fn test_supports() {
- todo!()
+ for (url, expected) in data_for_test_supports() {
+ let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let config = Rc::new(RefCell::new(make_config()));
+
+ assert_eq!(
+ expected,
+ GitLabDriver::supports(io, config, url, false).unwrap()
+ );
+ }
+}
+
+fn data_for_test_supports() -> Vec<(&'static str, bool)> {
+ let openssl = extension_loaded("openssl");
+ vec![
+ ("http://gitlab.com/foo/bar", true),
+ ("http://gitlab.mycompany.com:5443/foo/bar", true),
+ ("http://gitlab.com/foo/bar/", true),
+ ("http://gitlab.com/foo/bar/", true),
+ ("http://gitlab.com/foo/bar.git", true),
+ ("http://gitlab.com/foo/bar.git", true),
+ ("http://gitlab.com/foo/bar.baz.git", true),
+ ("https://gitlab.com/foo/bar", openssl),
+ ("https://gitlab.mycompany.com:5443/foo/bar", openssl),
+ ("git@gitlab.com:foo/bar.git", openssl),
+ ("git@example.com:foo/bar.git", false),
+ ("http://example.com/foo/bar", false),
+ ("http://mycompany.com/gitlab/mygroup/myproject", true),
+ ("https://mycompany.com/gitlab/mygroup/myproject", openssl),
+ (
+ "http://othercompany.com/nested/gitlab/mygroup/myproject",
+ true,
+ ),
+ (
+ "https://othercompany.com/nested/gitlab/mygroup/myproject",
+ openssl,
+ ),
+ (
+ "http://gitlab.com/mygroup/mysubgroup/mysubsubgroup/myproject",
+ true,
+ ),
+ (
+ "https://gitlab.com/mygroup/mysubgroup/mysubsubgroup/myproject",
+ openssl,
+ ),
+ ]
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_gitlab_sub_directory() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_gitlab_sub_group() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_gitlab_sub_directory_sub_group() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_forwards_options() {
todo!()
}
#[test]
-#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"]
+#[ignore = "HttpDownloaderMock (getHttpDownloaderMock) and the IOInterface MockObject are not ported"]
fn test_protocol_override_repository_url_generation() {
todo!()
}
diff --git a/crates/shirabe/tests/repository/vcs/hg_driver_test.rs b/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
index 155d7ce..7b6f1e6 100644
--- a/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
@@ -80,7 +80,7 @@ fn test_supports() {
// (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"]
+#[ignore = "requires getProcessExecutorMock with expects() hg branches/bookmarks command-sequence assertions and a getMockBuilder HttpDownloader mock; no ProcessExecutorMock/HttpDownloader mocking infrastructure exists"]
fn test_get_branches_filter_invalid_branch_names() {
let SetUp { home, config, io } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
@@ -89,7 +89,7 @@ fn test_get_branches_filter_invalid_branch_names() {
}
#[test]
-#[ignore = "needs an HgDriver instance (HttpDownloader reaches curl_multi_init, todo!()) and a mocked ProcessExecutor"]
+#[ignore = "requires getProcessExecutorMock and a getMockBuilder HttpDownloader mock to construct HgDriver; no ProcessExecutorMock/HttpDownloader mocking infrastructure exists"]
fn test_file_get_content_invalid_identifier() {
let SetUp { home, config, io } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
@@ -98,7 +98,7 @@ fn test_file_get_content_invalid_identifier() {
}
#[test]
-#[ignore = "needs an HgDriver instance (HttpDownloader reaches curl_multi_init, todo!()) and a mocked ProcessExecutor"]
+#[ignore = "requires getProcessExecutorMock and a getMockBuilder HttpDownloader mock to construct HgDriver; no ProcessExecutorMock/HttpDownloader mocking infrastructure exists"]
fn test_get_change_date_invalid_identifier() {
let SetUp { home, config, io } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
diff --git a/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs b/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs
index 1c28487..d9178dd 100644
--- a/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs
@@ -108,8 +108,8 @@ fn test_supports_returns_false_no_deep_check() {
// The remaining cases mock Perforce, the repository config and IO to drive initialization,
// composer-file detection and cleanup; mocking is not available here.
+#[ignore]
#[test]
-#[ignore = "mocks Perforce/repository/IO; mocking is not available"]
fn test_initialize_captures_variables_from_repo_config() {
let SetUp {
test_path,
@@ -122,20 +122,29 @@ fn test_initialize_captures_variables_from_repo_config() {
driver,
} = set_up();
let _tear_down = TearDown::new(test_path.path().to_path_buf());
- let _ = (
- &config,
- &repo_config,
- &io,
- &process,
- &http_downloader,
- &perforce,
- &driver,
- );
- todo!()
+ let _ = (&io, &process, &http_downloader, &perforce, &driver);
+
+ let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let config = Rc::new(RefCell::new(config));
+ let http_downloader = Rc::new(RefCell::new(shirabe::util::HttpDownloader::new(
+ io.clone(),
+ config.clone(),
+ IndexMap::new(),
+ false,
+ )));
+ let process = Rc::new(RefCell::new(shirabe::util::ProcessExecutor::new(Some(
+ io.clone(),
+ ))));
+
+ let mut driver = PerforceDriver::new(repo_config, io, config, http_downloader, process);
+ driver.initialize().unwrap();
+ assert_eq!(TEST_URL, driver.get_url());
+ assert_eq!(TEST_DEPOT, driver.get_depot());
+ assert_eq!(TEST_BRANCH, driver.get_branch());
}
+#[ignore = "needs a Perforce mock injected via reflection (overrideDriverInternalPerforce) to assert p4Login/checkStream/writeP4ClientSpec/connectClient are each called once; the perforce field is pub(crate) and no mock infra exists"]
#[test]
-#[ignore = "mocks Perforce/repository/IO; mocking is not available"]
fn test_initialize_logs_in_and_connects_client() {
let SetUp {
test_path,
@@ -160,8 +169,8 @@ fn test_initialize_logs_in_and_connects_client() {
todo!()
}
+#[ignore = "needs a Perforce mock injected via reflection (overrideDriverInternalPerforce) to stub getComposerInformation; the perforce field is pub(crate) and no mock infra exists"]
#[test]
-#[ignore = "mocks Perforce/repository/IO; mocking is not available"]
fn test_has_composer_file_returns_false_on_no_composer_file() {
let SetUp {
test_path,
@@ -186,8 +195,8 @@ fn test_has_composer_file_returns_false_on_no_composer_file() {
todo!()
}
+#[ignore = "needs a Perforce mock injected via reflection (overrideDriverInternalPerforce) to stub getComposerInformation; the perforce field is pub(crate) and no mock infra exists"]
#[test]
-#[ignore = "mocks Perforce/repository/IO; mocking is not available"]
fn test_has_composer_file_returns_true_with_one_or_more_composer_files() {
let SetUp {
test_path,
@@ -212,8 +221,8 @@ fn test_has_composer_file_returns_true_with_one_or_more_composer_files() {
todo!()
}
+#[ignore = "needs a Perforce mock injected via reflection (overrideDriverInternalPerforce) to assert cleanupClientSpec is called once; the perforce field is pub(crate) and no mock infra exists"]
#[test]
-#[ignore = "mocks Perforce/repository/IO; mocking is not available"]
fn test_cleanup() {
let SetUp {
test_path,
diff --git a/crates/shirabe/tests/repository/vcs/svn_driver_test.rs b/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
index 9625088..5ec9097 100644
--- a/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
@@ -77,8 +77,8 @@ fn test_support() {
// Constructs an SvnDriver and runs an svn command via a mocked ProcessExecutor; mocking is
// not available here.
+#[ignore = "requires ProcessExecutor mock (getProcessExecutorMock/expects) and IOInterface/HttpDownloader mocks, none available"]
#[test]
-#[ignore = "constructs an SvnDriver and mocks a ProcessExecutor for the svn invocation"]
fn test_wrong_credentials_in_url() {
let SetUp { home, config } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());