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/json | |
| 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/json')
| -rw-r--r-- | crates/shirabe/tests/json/composer_schema_test.rs | 40 | ||||
| -rw-r--r-- | crates/shirabe/tests/json/json_file_test.rs | 188 | ||||
| -rw-r--r-- | crates/shirabe/tests/json/json_manipulator_test.rs | 355 |
3 files changed, 456 insertions, 127 deletions
diff --git a/crates/shirabe/tests/json/composer_schema_test.rs b/crates/shirabe/tests/json/composer_schema_test.rs index 044bec1..1679b5d 100644 --- a/crates/shirabe/tests/json/composer_schema_test.rs +++ b/crates/shirabe/tests/json/composer_schema_test.rs @@ -2,18 +2,32 @@ // These validate documents against the bundled composer-schema.json via JsonFile's // json-schema validator, which is not ported. -macro_rules! stub { - ($name:ident) => { - #[test] - #[ignore = "needs JsonFile schema validation against the bundled composer-schema.json (not ported)"] - fn $name() { - todo!() - } - }; +#[test] +#[ignore = "needs JsonFile schema validation against the bundled composer-schema.json (not ported)"] +fn test_name_pattern() { + todo!() } -stub!(test_name_pattern); -stub!(test_version_pattern); -stub!(test_optional_abandoned_property); -stub!(test_require_types); -stub!(test_minimum_stability_values); +#[test] +#[ignore = "needs JsonFile schema validation against the bundled composer-schema.json (not ported)"] +fn test_version_pattern() { + todo!() +} + +#[test] +#[ignore = "needs JsonFile schema validation against the bundled composer-schema.json (not ported)"] +fn test_optional_abandoned_property() { + todo!() +} + +#[test] +#[ignore = "needs JsonFile schema validation against the bundled composer-schema.json (not ported)"] +fn test_require_types() { + todo!() +} + +#[test] +#[ignore = "needs JsonFile schema validation against the bundled composer-schema.json (not ported)"] +fn test_minimum_stability_values() { + todo!() +} diff --git a/crates/shirabe/tests/json/json_file_test.rs b/crates/shirabe/tests/json/json_file_test.rs index 5c632a9..36e1136 100644 --- a/crates/shirabe/tests/json/json_file_test.rs +++ b/crates/shirabe/tests/json/json_file_test.rs @@ -82,74 +82,150 @@ fn test_parse_error_detect_missing_colon() { // The encode cases assert JsonFile::encode output for specific PHP flag combinations and // data shapes (incl. stdClass vs array). Faithful flag mapping and value modeling are not // reproduced here. -macro_rules! encode_stub { - ($name:ident) => { - #[test] - #[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] - fn $name() { - todo!() - } - }; +#[test] +#[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] +fn test_simple_json_string() { + todo!() +} + +#[test] +#[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] +fn test_trailing_backslash() { + todo!() +} + +#[test] +#[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] +fn test_format_empty_array() { + todo!() +} + +#[test] +#[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] +fn test_escape() { + todo!() +} + +#[test] +#[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] +fn test_unicode() { + todo!() +} + +#[test] +#[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] +fn test_only_unicode() { + todo!() +} + +#[test] +#[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] +fn test_escaped_slashes() { + todo!() } -encode_stub!(test_simple_json_string); -encode_stub!(test_trailing_backslash); -encode_stub!(test_format_empty_array); -encode_stub!(test_escape); -encode_stub!(test_unicode); -encode_stub!(test_only_unicode); -encode_stub!(test_escaped_slashes); -encode_stub!(test_escaped_backslashes); -encode_stub!(test_escaped_unicode); -encode_stub!(test_double_escaped_unicode); +#[test] +#[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] +fn test_escaped_backslashes() { + todo!() +} + +#[test] +#[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] +fn test_escaped_unicode() { + todo!() +} + +#[test] +#[ignore = "asserts JsonFile::encode output for specific PHP flag/value combinations; not reproduced here"] +fn test_double_escaped_unicode() { + todo!() +} // These read a fixture composer.json and assert read/write indentation behaviour. -macro_rules! indentation_stub { - ($name:ident) => { - #[test] - #[ignore = "reads a fixture file and asserts indentation behaviour of JsonFile read/write"] - fn $name() { - todo!() - } - }; +#[test] +#[ignore = "reads a fixture file and asserts indentation behaviour of JsonFile read/write"] +fn test_preserve_indentation_after_read() { + todo!() } -indentation_stub!(test_preserve_indentation_after_read); -indentation_stub!(test_overwrites_indentation_by_default); +#[test] +#[ignore = "reads a fixture file and asserts indentation behaviour of JsonFile read/write"] +fn test_overwrites_indentation_by_default() { + todo!() +} // validateSchema needs the bundled JSON schema and the json-schema validator plus fixtures. -macro_rules! schema_stub { - ($name:ident) => { - #[test] - #[ignore = "needs JsonFile::validateSchema (json-schema validation) and the schema/fixtures"] - fn $name() { - todo!() - } - }; +#[test] +#[ignore = "needs JsonFile::validateSchema (json-schema validation) and the schema/fixtures"] +fn test_schema_validation() { + todo!() +} + +#[test] +#[ignore = "needs JsonFile::validateSchema (json-schema validation) and the schema/fixtures"] +fn test_schema_validation_error() { + todo!() +} + +#[test] +#[ignore = "needs JsonFile::validateSchema (json-schema validation) and the schema/fixtures"] +fn test_schema_validation_lax_additional_properties() { + todo!() +} + +#[test] +#[ignore = "needs JsonFile::validateSchema (json-schema validation) and the schema/fixtures"] +fn test_schema_validation_lax_required() { + todo!() +} + +#[test] +#[ignore = "needs JsonFile::validateSchema (json-schema validation) and the schema/fixtures"] +fn test_custom_schema_validation_lax() { + todo!() +} + +#[test] +#[ignore = "needs JsonFile::validateSchema (json-schema validation) and the schema/fixtures"] +fn test_custom_schema_validation_strict() { + todo!() } -schema_stub!(test_schema_validation); -schema_stub!(test_schema_validation_error); -schema_stub!(test_schema_validation_lax_additional_properties); -schema_stub!(test_schema_validation_lax_required); -schema_stub!(test_custom_schema_validation_lax); -schema_stub!(test_custom_schema_validation_strict); -schema_stub!(test_auth_schema_validation_with_custom_data_source); +#[test] +#[ignore = "needs JsonFile::validateSchema (json-schema validation) and the schema/fixtures"] +fn test_auth_schema_validation_with_custom_data_source() { + todo!() +} // The merge-conflict cases build large lock-file structures (with VCS conflict markers) and // assert the resulting ParsingException; the fixtures are sizeable and not reproduced here. -macro_rules! merge_stub { - ($name:ident) => { - #[test] - #[ignore = "builds a large lock-file structure with VCS merge markers; not reproduced here"] - fn $name() { - todo!() - } - }; +#[test] +#[ignore = "builds a large lock-file structure with VCS merge markers; not reproduced here"] +fn test_composer_lock_file_merge_conflict_simple() { + todo!() } -merge_stub!(test_composer_lock_file_merge_conflict_simple); -merge_stub!(test_composer_lock_file_merge_conflict_simple_crlf); -merge_stub!(test_composer_lock_file_merge_conflict_complex); -merge_stub!(test_composer_lock_file_merge_conflict_complex_crlf); -merge_stub!(test_composer_lock_file_merge_conflict_extended); +#[test] +#[ignore = "builds a large lock-file structure with VCS merge markers; not reproduced here"] +fn test_composer_lock_file_merge_conflict_simple_crlf() { + todo!() +} + +#[test] +#[ignore = "builds a large lock-file structure with VCS merge markers; not reproduced here"] +fn test_composer_lock_file_merge_conflict_complex() { + todo!() +} + +#[test] +#[ignore = "builds a large lock-file structure with VCS merge markers; not reproduced here"] +fn test_composer_lock_file_merge_conflict_complex_crlf() { + todo!() +} + +#[test] +#[ignore = "builds a large lock-file structure with VCS merge markers; not reproduced here"] +fn test_composer_lock_file_merge_conflict_extended() { + todo!() +} diff --git a/crates/shirabe/tests/json/json_manipulator_test.rs b/crates/shirabe/tests/json/json_manipulator_test.rs index 33af3a9..a3ede89 100644 --- a/crates/shirabe/tests/json/json_manipulator_test.rs +++ b/crates/shirabe/tests/json/json_manipulator_test.rs @@ -3,63 +3,302 @@ // JsonManipulator's text-rewriting operations reach addcslashes, which is todo!() in the // php-shim, so none of these cases can run yet. -macro_rules! stub { - ($name:ident) => { - #[test] - #[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] - fn $name() { - todo!() - } - }; +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_link() { + todo!() } -stub!(test_add_link); -stub!(test_add_link_and_sort_packages); -stub!(test_remove_sub_node); -stub!(test_remove_sub_node_from_require); -stub!(test_remove_sub_node_preserves_object_type_when_empty); -stub!(test_remove_sub_node_preserves_object_type_when_empty2); -stub!(test_add_sub_node_in_require); -stub!(test_add_extra_with_package); -stub!(test_add_config_with_package); -stub!(test_add_suggest_with_package); -stub!(test_add_repository_can_initialize_empty_repositories); -stub!(test_add_repository_can_initialize_from_scratch); -stub!(test_add_repository_can_append); -stub!(test_add_repository_can_prepend); -stub!(test_add_repository); -stub!(test_add_repository_can_override_deep_repos); -stub!(test_set_url_in_repository); -stub!(test_insert_repository_before_and_after_by_name); -stub!(test_remove_repository_removes_from_assoc_but_does_not_converts_from_assoc_to_list); -stub!(test_remove_repository_removes_from_list); -stub!(test_add_repository_converts_from_assoc_to_list); -stub!(test_add_config_setting_escapes); -stub!(test_add_config_setting_works_from_scratch); -stub!(test_add_config_setting_can_add); -stub!(test_add_config_setting_can_overwrite); -stub!(test_add_config_setting_can_overwrite_numbers); -stub!(test_add_config_setting_can_overwrite_arrays); -stub!(test_add_config_setting_can_add_sub_key_in_empty_config); -stub!(test_add_config_setting_can_add_sub_key_in_empty_val); -stub!(test_add_config_setting_can_add_sub_key_in_hash); -stub!(test_add_root_setting_does_not_break_dots); -stub!(test_remove_config_setting_can_remove_sub_key_in_hash); -stub!(test_remove_config_setting_can_remove_sub_key_in_hash_with_siblings); -stub!(test_add_main_key); -stub!(test_add_main_key_with_content_having_dollar_sign_followed_by_digit); -stub!(test_add_main_key_with_content_having_dollar_sign_followed_by_digit2); -stub!(test_update_main_key); -stub!(test_update_main_key2); -stub!(test_update_main_key3); -stub!(test_update_main_key_with_content_having_dollar_sign_followed_by_digit); -stub!(test_remove_main_key); -stub!(test_remove_main_key_if_empty); -stub!(test_remove_main_key_removes_key_where_value_is_null); -stub!(test_indent_detection); -stub!(test_remove_main_key_at_end_of_file); -stub!(test_add_list_item); -stub!(test_remove_list_item); -stub!(test_insert_list_item); -stub!(test_escaped_unicode_does_not_cause_backtrack_limit_error_github_issue8131); -stub!(test_large_file_does_not_cause_backtrack_limit_error_github_issue9595); +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_link_and_sort_packages() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_sub_node() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_sub_node_from_require() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_sub_node_preserves_object_type_when_empty() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_sub_node_preserves_object_type_when_empty2() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_sub_node_in_require() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_extra_with_package() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_config_with_package() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_suggest_with_package() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_repository_can_initialize_empty_repositories() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_repository_can_initialize_from_scratch() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_repository_can_append() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_repository_can_prepend() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_repository() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_repository_can_override_deep_repos() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_set_url_in_repository() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_insert_repository_before_and_after_by_name() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_repository_removes_from_assoc_but_does_not_converts_from_assoc_to_list() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_repository_removes_from_list() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_repository_converts_from_assoc_to_list() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_config_setting_escapes() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_config_setting_works_from_scratch() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_config_setting_can_add() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_config_setting_can_overwrite() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_config_setting_can_overwrite_numbers() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_config_setting_can_overwrite_arrays() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_config_setting_can_add_sub_key_in_empty_config() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_config_setting_can_add_sub_key_in_empty_val() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_config_setting_can_add_sub_key_in_hash() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_root_setting_does_not_break_dots() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_config_setting_can_remove_sub_key_in_hash() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_config_setting_can_remove_sub_key_in_hash_with_siblings() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_main_key() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_main_key_with_content_having_dollar_sign_followed_by_digit() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_main_key_with_content_having_dollar_sign_followed_by_digit2() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_update_main_key() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_update_main_key2() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_update_main_key3() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_update_main_key_with_content_having_dollar_sign_followed_by_digit() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_main_key() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_main_key_if_empty() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_main_key_removes_key_where_value_is_null() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_indent_detection() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_main_key_at_end_of_file() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_add_list_item() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_remove_list_item() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_insert_list_item() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_escaped_unicode_does_not_cause_backtrack_limit_error_github_issue8131() { + todo!() +} + +#[test] +#[ignore = "JsonManipulator operations reach addcslashes (todo!()) in the php-shim"] +fn test_large_file_does_not_cause_backtrack_limit_error_github_issue9595() { + todo!() +} |
