-
Notifications
You must be signed in to change notification settings - Fork 2
TestGen generating unit tests for function code validation #95
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 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 |
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
Copilot reviewed 4 out of 6 changed files in this pull request and generated no new comments.
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.