Skip to content

✅ Add unit tests for rpc mode code generation#9

Merged
x5iu merged 2 commits intomainfrom
feat/rpc-tests
Dec 18, 2025
Merged

✅ Add unit tests for rpc mode code generation#9
x5iu merged 2 commits intomainfrom
feat/rpc-tests

Conversation

@x5iu
Copy link
Copy Markdown
Owner

@x5iu x5iu commented Dec 16, 2025

Summary

  • Add comprehensive unit tests for gen/rpc.go in gen/rpc_test.go
  • Create test data in gen/testdata/rpc/test.go following the existing patterns from sqlx and api tests
  • Cover all validation paths in the RPC code generation logic

Test Cases

Test Description
success Basic RPC interface generation
success_pointer_reply RPC with pointer return type
success_nort RPC with rpc/nort feature flag
fail_no_input Method without input parameter
fail_too_many_inputs Method with more than 1 input
fail_no_output Method without output parameters
fail_one_output Method with only 1 output
fail_too_many_outputs Method with more than 2 outputs
fail_no_error Method without error as second output
fail_no_name_type Method without named parameter
fail_no_type_decl No type declaration found
fail_no_iface_type No interface type found

Test plan

  • All new tests pass: go test -v -run TestBuildRpc ./gen
  • Full test suite passes: ./test.sh
  • Code passes go vet ./gen/*.go

🤖 Generated with Claude Code

Add comprehensive test coverage for gen/rpc.go, following the same
patterns used by sqlx_test.go and api_test.go.

Test cases include:
- success: basic RPC interface generation
- success_pointer_reply: RPC with pointer return type
- success_nort: RPC with rpc/nort feature flag
- fail_no_input: method without input parameter
- fail_too_many_inputs: method with more than 1 input
- fail_no_output: method without output parameters
- fail_one_output: method with only 1 output
- fail_too_many_outputs: method with more than 2 outputs
- fail_no_error: method without error as second output
- fail_no_name_type: method without named parameter
- fail_no_type_decl: no type declaration found
- fail_no_iface_type: no interface type found

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@x5iu x5iu merged commit d89f738 into main Dec 18, 2025
9 checks passed
@x5iu x5iu deleted the feat/rpc-tests branch December 18, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants