Conversation
Contributor
There was a problem hiding this comment.
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 |
fabriciogpp
approved these changes
Nov 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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]