From 657440d01423b50153d07ebc288d9bd2fc982d52 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 21 Jun 2026 16:31:44 +0900 Subject: refactor(json): eliminate json_last_error in favor of Result json_encode/json_encode_ex now return anyhow::Result instead of Option, so callers no longer need json_last_error() to get the failure reason. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/tests/json/json_file_test.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'crates/shirabe/tests/json') diff --git a/crates/shirabe/tests/json/json_file_test.rs b/crates/shirabe/tests/json/json_file_test.rs index 36e1136..b6fecc6 100644 --- a/crates/shirabe/tests/json/json_file_test.rs +++ b/crates/shirabe/tests/json/json_file_test.rs @@ -10,70 +10,70 @@ fn expect_parse_exception(text: &str, json: &str) { } #[test] -#[ignore = "JsonFile::parse_json error path reaches json_last_error (todo!()) in the php-shim"] +#[ignore = "JsonFile::parse_json error path reaches JsonParser::new()/lint() (todo!()); the JSON linter is not yet ported"] fn test_parse_error_detect_extra_comma() { let json = "{\n \"foo\": \"bar\",\n}"; expect_parse_exception("Parse error on line 2", json); } #[test] -#[ignore = "JsonFile::parse_json error path reaches json_last_error (todo!()) in the php-shim"] +#[ignore = "JsonFile::parse_json error path reaches JsonParser::new()/lint() (todo!()); the JSON linter is not yet ported"] fn test_parse_error_detect_extra_comma_in_array() { let json = "{\n \"foo\": [\n \"bar\",\n ]\n}"; expect_parse_exception("Parse error on line 3", json); } #[test] -#[ignore = "JsonFile::parse_json error path reaches json_last_error (todo!()) in the php-shim"] +#[ignore = "JsonFile::parse_json error path reaches JsonParser::new()/lint() (todo!()); the JSON linter is not yet ported"] fn test_parse_error_detect_unescaped_backslash() { let json = "{\n \"fo\\o\": \"bar\"\n}"; expect_parse_exception("Parse error on line 1", json); } #[test] -#[ignore = "JsonFile::parse_json error path reaches json_last_error (todo!()) in the php-shim"] +#[ignore = "JsonFile::parse_json error path reaches JsonParser::new()/lint() (todo!()); the JSON linter is not yet ported"] fn test_parse_error_skips_escaped_backslash() { let json = "{\n \"fo\\\\o\": \"bar\"\n \"a\": \"b\"\n}"; expect_parse_exception("Parse error on line 2", json); } #[test] -#[ignore = "JsonFile::parse_json error path reaches json_last_error (todo!()) in the php-shim"] +#[ignore = "JsonFile::parse_json error path reaches JsonParser::new()/lint() (todo!()); the JSON linter is not yet ported"] fn test_parse_error_detect_single_quotes() { let json = "{\n 'foo': \"bar\"\n}"; expect_parse_exception("Parse error on line 1", json); } #[test] -#[ignore = "JsonFile::parse_json error path reaches json_last_error (todo!()) in the php-shim"] +#[ignore = "JsonFile::parse_json error path reaches JsonParser::new()/lint() (todo!()); the JSON linter is not yet ported"] fn test_parse_error_detect_missing_quotes() { let json = "{\n foo: \"bar\"\n}"; expect_parse_exception("Parse error on line 1", json); } #[test] -#[ignore = "JsonFile::parse_json error path reaches json_last_error (todo!()) in the php-shim"] +#[ignore = "JsonFile::parse_json error path reaches JsonParser::new()/lint() (todo!()); the JSON linter is not yet ported"] fn test_parse_error_detect_array_as_hash() { let json = "{\n \"foo\": [\"bar\": \"baz\"]\n}"; expect_parse_exception("Parse error on line 2", json); } #[test] -#[ignore = "JsonFile::parse_json error path reaches json_last_error (todo!()) in the php-shim"] +#[ignore = "JsonFile::parse_json error path reaches JsonParser::new()/lint() (todo!()); the JSON linter is not yet ported"] fn test_parse_error_detect_missing_comma() { let json = "{\n \"foo\": \"bar\"\n \"bar\": \"foo\"\n}"; expect_parse_exception("Parse error on line 2", json); } #[test] -#[ignore = "JsonFile::parse_json error path reaches json_last_error (todo!()) in the php-shim"] +#[ignore = "JsonFile::parse_json error path reaches JsonParser::new()/lint() (todo!()); the JSON linter is not yet ported"] fn test_parse_error_detect_missing_comma_multiline() { let json = "{\n \"foo\": \"barbar\"\n\n \"bar\": \"foo\"\n}"; expect_parse_exception("Parse error on line 2", json); } #[test] -#[ignore = "JsonFile::parse_json error path reaches json_last_error (todo!()) in the php-shim"] +#[ignore = "JsonFile::parse_json error path reaches JsonParser::new()/lint() (todo!()); the JSON linter is not yet ported"] fn test_parse_error_detect_missing_colon() { let json = "{\n \"foo\": \"bar\",\n \"bar\" \"foo\"\n}"; expect_parse_exception("Parse error on line 3", json); -- cgit v1.3.1