-
Notifications
You must be signed in to change notification settings - Fork 2
cleanup useless tests (#93) #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the test generation infrastructure for ValidGen by removing old template-based benchmark tests and replacing them with a new comprehensive pointer validation benchmark suite. The changes improve error handling in the test generator and introduce a reusable template execution utility.
Key Changes
- Removed old comparative performance test templates and generated files
- Added new comprehensive pointer validation benchmarks (9097 lines covering all validation types for pointer fields)
- Improved error handling in test generation with proper error propagation and exit codes
- Extracted template execution logic into a reusable utility function
Reviewed Changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/endtoend/generated_numeric_int_tests.go | Minor whitespace cleanup (removed trailing whitespace) |
| tests/cmpbenchtests/validgen_vs_validator_test.tpl | Deleted old benchmark test template |
| tests/cmpbenchtests/validator__.go | Removed old string validation benchmarks |
| tests/cmpbenchtests/types.tpl | Deleted old types template |
| tests/cmpbenchtests/generated_tests/validgen_vs_validator_test.go | Deleted old generated benchmark tests |
| tests/cmpbenchtests/generated_tests/types.go | Deleted old generated type definitions |
| tests/cmpbenchtests/generated_cmp_perf_pointer_test.go | Added comprehensive pointer validation benchmarks |
| testgen/generate_tests.go | Enhanced error handling with proper error checking and exit codes |
| testgen/execute_template.go | New reusable template execution utility |
Closes #93
This PR refactors the test generation logic in the
testgenpackage and updates the Makefile and related test files to streamline how generated test files are handled. The main improvements include consolidating template execution logic, improving error handling, and simplifying the structure of generated tests. The changes also remove redundant and outdated unit tests.Test Generation Refactoring:
ExecTemplateintestgen/execute_template.goto centralize template reading, formatting, and file writing for generated tests, reducing code duplication and improving maintainability.testgen/generate_cmp_perf_tests.goandtestgen/generate_function_code_tests.goto use the newExecTemplatehelper, improving error handling and replacinglogcalls withfmt.Printffor more consistent output. The test generation functions now return errors instead of exiting abruptly. [1] [2] [3] [4] [5] [6] [7]Makefile and Test File Management:
tests/cmpbenchtests/instead of a subdirectory, and adjusted the test commands to match the new file locations for consistency and easier management. [1] [2]Test Cleanup:
internal/codegenerator/build_validator_test.go, including pointer type validation tests and many basic field validation cases, leaving only the most relevant and complex test scenarios. [1] [2] [3] [4] [5]