Skip to content

Conversation

@alexgarzao
Copy link
Collaborator

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

  • Added a new template file testgen/function_code_test.tpl for 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.
  • Implemented 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.
  • Refactored the main test generation entry point in testgen/generate_tests.go to call the new generateFunctionCodeUnitTests and renamed other test generation functions for clarity and separation of concerns.

Build Pipeline Update

  • Updated the Makefile to 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.

@alexgarzao alexgarzao requested a review from Copilot October 28, 2025 13:27
@alexgarzao alexgarzao self-assigned this Oct 28, 2025
Copy link
Contributor

Copilot AI left a 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 (generateValidationTypesEndToEndTests and generateValidationCodeUnitTests)
  • 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

@alexgarzao alexgarzao requested a review from Copilot October 28, 2025 13:56
Copy link
Contributor

Copilot AI left a 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.

@alexgarzao alexgarzao changed the title 93 testgen function code tests TestGen generating unit tests for function code validation Oct 28, 2025
@alexgarzao alexgarzao merged commit 102d5a7 into main Oct 29, 2025
4 checks passed
@alexgarzao alexgarzao deleted the 93-testgen-function-code-tests branch October 29, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants