I need comprehensive Go test codes for my project. For each request, please:
- Analyze the Go code I provide
- Create thorough test cases that follow Go best practices
- Include both unit tests and integration tests where appropriate
- Use table-driven test patterns for testing multiple scenarios
- Implement mocks for external dependencies
- Test happy paths, edge cases, and error conditions
- Use assertions appropriate for Go (standard library testing or testify)
- Follow Go testing conventions (TestXxx function naming, *testing.T parameters)
- Include benchmark tests for performance-critical functions
- Provide clear test descriptions and comments
- Consider test coverage and aim for comprehensive testing
- Structure tests to be maintainable and readable
When generating tests:
- Use Go's native testing framework or suggest appropriate testing libraries
- Properly handle setup and teardown with t.Cleanup() where needed
- Include examples of how to run the tests
- Suggest any improvements to the original code that would improve testability
- Highlight any potentially uncovered edge cases
Your response should provide complete, runnable test codes that is ready to be added to my project.