TestGen generating unit tests for function code validation#95
Merged
alexgarzao merged 16 commits intomainfrom Oct 29, 2025
Merged
TestGen generating unit tests for function code validation#95alexgarzao merged 16 commits intomainfrom
alexgarzao merged 16 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new test generation system for validating function code generation logic, refactors existing test generators for clarity, and updates the build pipeline to handle the new test files. The main purpose is to expand test coverage for the function validator code generation process.
Key Changes
- Added a new function code test generator that creates comprehensive unit tests for both pointer and non-pointer struct field scenarios
- Renamed existing test generation functions to be more descriptive (
generateValidationTypesEndToEndTestsandgenerateValidationCodeUnitTests) - Updated the Makefile to move newly generated function code test files to the correct destination directory
Reviewed Changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| testgen/generate_tests.go | Updated main entry point to call renamed test generators and new function code test generator |
| testgen/generate_function_code_tests.go | Implements new generator for function code validation unit tests with support for pointer/non-pointer scenarios |
| testgen/function_code_test.tpl | Defines template for generating function code unit tests with struct and field validation scenarios |
| Makefile | Extended testgen target to move generated function code test files to internal/codegenerator/ directory |
fabriciogpp
approved these changes
Oct 29, 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 introduces a new set of generated unit tests for function code validation, refactors the test generation process, and updates the build pipeline to include these new tests. The main focus is on expanding test coverage for function validator code and streamlining the test generation workflow.
Test Generation Enhancements
testgen/function_code_test.tplfor generating unit tests that validate the output of function code generation logic. This template supports comprehensive test cases for various struct and field validation scenarios.testgen/generate_function_code_tests.go, a new generator that creates function code unit tests for both pointer and non-pointer struct fields. It constructs test cases, generates expected code, and writes formatted Go test files.testgen/generate_tests.goto call the newgenerateFunctionCodeUnitTestsand renamed other test generation functions for clarity and separation of concerns.Build Pipeline Update
Makefileto move newly generated function code test files (generated_function_code_*_test.go) into the correct destination directory (internal/codegenerator/) as part of the test generation step.