diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-21 13:11:49 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-21 13:11:49 +0900 |
| commit | f0f5f084c883dc4f5b6e61603e82cd1c2092fd9d (patch) | |
| tree | a8b91efea7f17e61a8d0d9a82604d3ed964010a7 /crates/shirabe/tests/repository | |
| parent | b1571202200e4dc630202928f5ff78959273c7ec (diff) | |
| download | php-shirabe-f0f5f084c883dc4f5b6e61603e82cd1c2092fd9d.tar.gz php-shirabe-f0f5f084c883dc4f5b6e61603e82cd1c2092fd9d.tar.zst php-shirabe-f0f5f084c883dc4f5b6e61603e82cd1c2092fd9d.zip | |
test(tests): expand stub macros into plain test functions
The per-file stub!/encode_stub!/etc. macros generated #[ignore]d test
functions but obscured the individual test bodies. Expanding them inline
removes the macro indirection so future ports can fill in each function
directly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/repository')
5 files changed, 286 insertions, 90 deletions
diff --git a/crates/shirabe/tests/repository/composer_repository_test.rs b/crates/shirabe/tests/repository/composer_repository_test.rs index 89c55b5..f600a55 100644 --- a/crates/shirabe/tests/repository/composer_repository_test.rs +++ b/crates/shirabe/tests/repository/composer_repository_test.rs @@ -3,22 +3,57 @@ // These construct a ComposerRepository with a mocked HttpDownloader/IO/Config and parse // provider/package data whose constraints go through a look-around regex; mocking is not // available and a real HttpDownloader reaches curl_multi_init (todo!()). -macro_rules! stub { - ($name:ident) => { - #[test] - #[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"] - fn $name() { - todo!() - } - }; +#[test] +#[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"] +fn test_load_data() { + todo!() } -stub!(test_load_data); -stub!(test_what_provides); -stub!(test_search_with_type); -stub!(test_search_with_special_chars); -stub!(test_search_with_abandoned_packages); -stub!(test_canonicalize_url); -stub!(test_get_provider_names_will_return_partial_package_names); -stub!(test_get_security_advisories_assert_repository_http_options_are_used); -stub!(test_get_security_advisories_assert_repository_advisories_is_zero_indexed_array_with_consecutive_keys); +#[test] +#[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"] +fn test_what_provides() { + todo!() +} + +#[test] +#[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"] +fn test_search_with_type() { + todo!() +} + +#[test] +#[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"] +fn test_search_with_special_chars() { + todo!() +} + +#[test] +#[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"] +fn test_search_with_abandoned_packages() { + todo!() +} + +#[test] +#[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"] +fn test_canonicalize_url() { + todo!() +} + +#[test] +#[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"] +fn test_get_provider_names_will_return_partial_package_names() { + todo!() +} + +#[test] +#[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"] +fn test_get_security_advisories_assert_repository_http_options_are_used() { + todo!() +} + +#[test] +#[ignore = "mocks HttpDownloader/IO (curl_multi_init todo!()) and parses constraints via a look-around regex"] +fn test_get_security_advisories_assert_repository_advisories_is_zero_indexed_array_with_consecutive_keys() + { + todo!() +} diff --git a/crates/shirabe/tests/repository/filesystem_repository_test.rs b/crates/shirabe/tests/repository/filesystem_repository_test.rs index 74a6794..d798fc9 100644 --- a/crates/shirabe/tests/repository/filesystem_repository_test.rs +++ b/crates/shirabe/tests/repository/filesystem_repository_test.rs @@ -3,19 +3,38 @@ // These read/write installed.json and installed.php fixtures via JsonFile and assert the // generated output; the file IO/manipulation (JsonManipulator reaches addcslashes, todo!()) // and fixtures are not ported. -macro_rules! stub { - ($name:ident) => { - #[test] - #[ignore = "reads/writes installed.json/installed.php fixtures via JsonFile/JsonManipulator (addcslashes todo!())"] - fn $name() { - todo!() - } - }; +#[test] +#[ignore = "reads/writes installed.json/installed.php fixtures via JsonFile/JsonManipulator (addcslashes todo!())"] +fn test_repository_read() { + todo!() } -stub!(test_repository_read); -stub!(test_corrupted_repository_file); -stub!(test_unexistent_repository_file); -stub!(test_repository_write); -stub!(test_repository_writes_installed_php); -stub!(test_safely_load_installed_versions); +#[test] +#[ignore = "reads/writes installed.json/installed.php fixtures via JsonFile/JsonManipulator (addcslashes todo!())"] +fn test_corrupted_repository_file() { + todo!() +} + +#[test] +#[ignore = "reads/writes installed.json/installed.php fixtures via JsonFile/JsonManipulator (addcslashes todo!())"] +fn test_unexistent_repository_file() { + todo!() +} + +#[test] +#[ignore = "reads/writes installed.json/installed.php fixtures via JsonFile/JsonManipulator (addcslashes todo!())"] +fn test_repository_write() { + todo!() +} + +#[test] +#[ignore = "reads/writes installed.json/installed.php fixtures via JsonFile/JsonManipulator (addcslashes todo!())"] +fn test_repository_writes_installed_php() { + todo!() +} + +#[test] +#[ignore = "reads/writes installed.json/installed.php fixtures via JsonFile/JsonManipulator (addcslashes todo!())"] +fn test_safely_load_installed_versions() { + todo!() +} diff --git a/crates/shirabe/tests/repository/platform_repository_test.rs b/crates/shirabe/tests/repository/platform_repository_test.rs index d06f8f5..d19b615 100644 --- a/crates/shirabe/tests/repository/platform_repository_test.rs +++ b/crates/shirabe/tests/repository/platform_repository_test.rs @@ -3,19 +3,38 @@ // These probe runtime/extension/library versions and assert the synthesized platform // packages; the detection mocks ProcessExecutor/Runtime/HhvmDetector and the package // versions are parsed through a look-around regex. -macro_rules! stub { - ($name:ident) => { - #[test] - #[ignore = "not yet ported (platform detection mocks Runtime/ProcessExecutor; version parsing uses a look-around regex)"] - fn $name() { - todo!() - } - }; +#[test] +#[ignore = "not yet ported (platform detection mocks Runtime/ProcessExecutor; version parsing uses a look-around regex)"] +fn test_hhvm_package() { + todo!() } -stub!(test_hhvm_package); -stub!(test_php_version); -stub!(test_inet_pton_regression); -stub!(test_library_information); -stub!(test_composer_platform_version); -stub!(test_valid_platform_packages); +#[test] +#[ignore = "not yet ported (platform detection mocks Runtime/ProcessExecutor; version parsing uses a look-around regex)"] +fn test_php_version() { + todo!() +} + +#[test] +#[ignore = "not yet ported (platform detection mocks Runtime/ProcessExecutor; version parsing uses a look-around regex)"] +fn test_inet_pton_regression() { + todo!() +} + +#[test] +#[ignore = "not yet ported (platform detection mocks Runtime/ProcessExecutor; version parsing uses a look-around regex)"] +fn test_library_information() { + todo!() +} + +#[test] +#[ignore = "not yet ported (platform detection mocks Runtime/ProcessExecutor; version parsing uses a look-around regex)"] +fn test_composer_platform_version() { + todo!() +} + +#[test] +#[ignore = "not yet ported (platform detection mocks Runtime/ProcessExecutor; version parsing uses a look-around regex)"] +fn test_valid_platform_packages() { + todo!() +} diff --git a/crates/shirabe/tests/repository/vcs/git_driver_test.rs b/crates/shirabe/tests/repository/vcs/git_driver_test.rs index c36470c..1aacbf9 100644 --- a/crates/shirabe/tests/repository/vcs/git_driver_test.rs +++ b/crates/shirabe/tests/repository/vcs/git_driver_test.rs @@ -63,25 +63,74 @@ impl Drop for TearDown { } } -macro_rules! git_stub { - ($name:ident) => { - #[test] - #[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"] - fn $name() { - let SetUp { - home, - config: _, - network_env, - } = set_up(); - let _tear_down = TearDown::new(home.path().to_path_buf(), network_env); - todo!() - } - }; +#[test] +#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"] +fn test_get_root_identifier_from_remote_local_repository() { + let SetUp { + home, + config: _, + network_env, + } = set_up(); + let _tear_down = TearDown::new(home.path().to_path_buf(), network_env); + todo!() +} + +#[test] +#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"] +fn test_get_root_identifier_from_remote() { + let SetUp { + home, + config: _, + network_env, + } = set_up(); + let _tear_down = TearDown::new(home.path().to_path_buf(), network_env); + todo!() } -git_stub!(test_get_root_identifier_from_remote_local_repository); -git_stub!(test_get_root_identifier_from_remote); -git_stub!(test_get_root_identifier_from_local_with_network_disabled); -git_stub!(test_get_branches_filter_invalid_branch_names); -git_stub!(test_file_get_content_invalid_identifier); -git_stub!(test_get_change_date_invalid_identifier); +#[test] +#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"] +fn test_get_root_identifier_from_local_with_network_disabled() { + let SetUp { + home, + config: _, + network_env, + } = set_up(); + let _tear_down = TearDown::new(home.path().to_path_buf(), network_env); + todo!() +} + +#[test] +#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"] +fn test_get_branches_filter_invalid_branch_names() { + let SetUp { + home, + config: _, + network_env, + } = set_up(); + let _tear_down = TearDown::new(home.path().to_path_buf(), network_env); + todo!() +} + +#[test] +#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"] +fn test_file_get_content_invalid_identifier() { + let SetUp { + home, + config: _, + network_env, + } = set_up(); + let _tear_down = TearDown::new(home.path().to_path_buf(), network_env); + todo!() +} + +#[test] +#[ignore = "constructs a GitDriver and mocks a ProcessExecutor/HttpDownloader (curl_multi_init todo!())"] +fn test_get_change_date_invalid_identifier() { + let SetUp { + home, + config: _, + network_env, + } = set_up(); + let _tear_down = TearDown::new(home.path().to_path_buf(), network_env); + todo!() +} diff --git a/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs b/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs index a9432c4..1e13ada 100644 --- a/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs +++ b/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs @@ -4,30 +4,104 @@ // 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. -macro_rules! gitlab_stub { - ($name:ident) => { - #[test] - #[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] - fn $name() { - todo!() - } - }; +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_initialize() { + todo!() } -gitlab_stub!(test_initialize); -gitlab_stub!(test_initialize_public_project); -gitlab_stub!(test_initialize_public_project_as_anonymous); -gitlab_stub!(test_initialize_with_port_number); -gitlab_stub!(test_invalid_support_data); -gitlab_stub!(test_get_dist); -gitlab_stub!(test_get_source); -gitlab_stub!(test_get_source_given_public_project); -gitlab_stub!(test_get_tags); -gitlab_stub!(test_get_paginated_refs); -gitlab_stub!(test_get_branches); -gitlab_stub!(test_supports); -gitlab_stub!(test_gitlab_sub_directory); -gitlab_stub!(test_gitlab_sub_group); -gitlab_stub!(test_gitlab_sub_directory_sub_group); -gitlab_stub!(test_forwards_options); -gitlab_stub!(test_protocol_override_repository_url_generation); +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_initialize_public_project() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +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"] +fn test_initialize_with_port_number() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_invalid_support_data() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_get_dist() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_get_source() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +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"] +fn test_get_tags() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_get_paginated_refs() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_get_branches() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_supports() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_gitlab_sub_directory() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_gitlab_sub_group() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +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"] +fn test_forwards_options() { + todo!() +} + +#[test] +#[ignore = "GitLabDriver tests mock HttpDownloader/IO (curl_multi_init todo!()) or need setUp gitlab-domains config"] +fn test_protocol_override_repository_url_generation() { + todo!() +} |
