Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the benchmark test infrastructure by removing a template-based generation approach and replacing it with a large, directly committed pointer-based benchmark test file. The changes include:
- Removal of template files (
types.tpl,validgen_vs_validator_test.tpl) and the template generator main file - Deletion of generated test files that used the old template system
- Addition of a comprehensive 9097-line benchmark test file covering pointer types
- Minor whitespace cleanup in existing test files
Reviewed Changes
Copilot reviewed 13 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tests/endtoend/generated_numeric_int_tests.go |
Removed trailing whitespace on line 19 |
tests/cmpbenchtests/validgen_vs_validator_test.tpl |
Deleted template file for generating benchmark tests |
tests/cmpbenchtests/validator__.go |
Removed 10 generated string validation functions (email, eq, len, etc.) |
tests/cmpbenchtests/types.tpl |
Deleted template file for generating test types |
tests/cmpbenchtests/generated_tests/validgen_vs_validator_test.go |
Deleted 279-line generated benchmark test file |
tests/cmpbenchtests/generated_tests/types.go |
Deleted 83-line generated type definitions file |
tests/cmpbenchtests/generated_cmp_perf_pointer_test.go |
Added comprehensive 9097-line pointer-based benchmark tests |
tests/cmpbenchtests/generate_cmp_benchtests_main.go |
Deleted 134-line template generation utility |
51bd54a to
8d09241
Compare
fabriciogpp
approved these changes
Nov 3, 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.
This PR refactors the test generation code to simplify and standardize file generation logic, improve error handling, and reduce code duplication. The main changes include extracting template execution into a reusable function, updating all test generation functions to return errors, and ensuring errors are properly surfaced to the main entrypoint. Additionally, verbose logging is replaced with standard output, and custom file generation methods are removed in favor of a shared utility.
Refactoring and code simplification:
ExecTemplatefunction inexecute_template.goto handle reading, parsing, executing, formatting, and writing template-based code generation; this eliminates repeated logic across test generators.GenerateFilemethods and replaced their usage with the newExecTemplateutility in all test generation files (generate_validation_types_tests.go,generate_validation_code_tests.go,generate_function_code_tests.go,generate_cmp_perf_tests.go). [1] [2] [3] [4]Error handling improvements:
generateValidationTypesEndToEndTests,generateValidationCodeUnitTests,generateFunctionCodeUnitTests,generateComparativePerformanceTests) to return errors instead of panicking or logging fatally; errors are now checked and handled inmain(), which exits with a non-zero status on failure. [1] [2] [3] [4] [5]log.Fatalfandlog.Printfcalls withfmt.Printfand error returns, ensuring that errors are consistently propagated and logged in a uniform way. [1] [2] [3] [4] [5] [6] [7]General cleanup:
log,os,bytes,text/template,go/format) from generator files since this logic is now encapsulated inExecTemplate. [1] [2] [3] [4]These changes make the codebase easier to maintain, reduce duplication, and provide more predictable error handling during test code generation.