Replace assert_empty with assert_equal using explicit literals

Due to overly aggressive detection by RuboCop Minitest, the distinction between `[]` and `{}` was uniformly replaced with `assert_empty`,
making it impossible to differentiate between them.
As a result of https://github.com/rubocop/rubocop-minitest/issues/344, where the `Minitest/AssertEmptyLiteral` cop was disabled,
the return value has been expressed using explicit literal forms.
This commit is contained in:
Koichi ITO 2026-02-24 16:08:10 +09:00
commit a44799b262
3 changed files with 22 additions and 22 deletions

View file

@ -213,7 +213,7 @@ module MCP
# This test verifies the complete integration from server to transport
# Start with no output
assert_empty @mock_stdout.output
assert_equal([], @mock_stdout.output)
# Add a prompt and notify
@server.define_prompt(

View file

@ -45,7 +45,7 @@ module MCP
response = JSON.parse(output.string, symbolize_names: true)
assert_equal("2.0", response[:jsonrpc])
assert_equal("123", response[:id])
assert_empty(response[:result])
assert_equal({}, response[:result])
refute(@transport.instance_variable_get(:@open))
ensure
$stdin = original_stdin

View file

@ -46,7 +46,7 @@ module MCP
body = JSON.parse(response[2][0])
assert_equal "2.0", body["jsonrpc"]
assert_equal "123", body["id"]
assert_empty(body["result"])
assert_equal({}, body["result"])
end
test "handles POST request with invalid JSON" do
@ -315,7 +315,7 @@ module MCP
@transport.close
# Verify session was cleaned up
assert_empty @transport.instance_variable_get(:@sessions)
assert_equal({}, @transport.instance_variable_get(:@sessions))
end
test "sends notification to correct session with multiple active sessions" do
@ -847,7 +847,7 @@ module MCP
response = stateless_transport.handle_request(request)
assert_equal 202, response[0]
assert_empty(response[1])
assert_equal({}, response[1])
body = response[2][0]
assert_nil(body)
@ -896,8 +896,8 @@ module MCP
response = @transport.handle_request(notif_request)
assert_equal 202, response[0]
assert_empty(response[1])
assert_empty(response[2])
assert_equal({}, response[1])
assert_equal([], response[2])
end
test "handles POST request with body including JSON-RPC response object and returns with no body" do
@ -922,8 +922,8 @@ module MCP
response = @transport.handle_request(request)
assert_equal 202, response[0]
assert_empty(response[1])
assert_empty(response[2])
assert_equal({}, response[1])
assert_equal([], response[2])
end
private