Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

feat: add Go test parser support#19

Merged
kubrickcode merged 1 commit intomainfrom
develop/shlee/7
Dec 4, 2025
Merged

feat: add Go test parser support#19
kubrickcode merged 1 commit intomainfrom
develop/shlee/7

Conversation

@kubrickcode
Copy link
Member

Add gotesting strategy for parsing Go test files (*_test.go)

  • Extract func TestXxx(t *testing.T) format test functions
  • Extract t.Run() subtests (flat structure)
  • Integrate tree-sitter Go language support

fix #7

@gemini-code-assist
Copy link

Summary of Changes

Hello @kubrickcode, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the system's capability by adding comprehensive support for parsing Go test files. It introduces a dedicated strategy that leverages tree-sitter to accurately identify and extract both top-level test functions and nested subtests, ensuring that Go projects can be properly analyzed for their testing structures.

Highlights

  • Go Test Parser Support: Introduced a new strategy to parse Go test files (*_test.go), enabling the system to understand and extract Go-specific test structures.
  • Test Function Extraction: The parser can now correctly identify and extract standard Go test functions following the func TestXxx(t *testing.T) format.
  • Subtest Recognition: Implemented logic to extract t.Run() subtests, treating them as a flat structure within their parent test suite.
  • Tree-sitter Integration: Integrated tree-sitter's Go language support to provide robust and accurate parsing of Go source code for test detection.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions bot added the feature New feature label Dec 4, 2025
@kubrickcode
Copy link
Member Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a parser for Go test files, which is a valuable addition. The implementation is well-structured and includes a comprehensive set of tests. My review focuses on a few areas for improvement: enhancing test performance by enabling parallel execution, ensuring associated tests are updated to reflect changes, and refactoring a function to align better with the style guide's preference for pure functions. Overall, this is a solid contribution.

@kubrickcode
Copy link
Member Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a parser for Go test files, which is a great addition. The implementation uses tree-sitter and correctly identifies test functions and subtests. The code is well-structured and includes a comprehensive test suite.

I've identified a correctness issue in the validation of test function parameters and a potential improvement for handling string literals. I've also suggested an additional test case to cover the parameter validation logic. Overall, this is a solid contribution.

@kubrickcode
Copy link
Member Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new parser for Go test files using the go-testing strategy. The implementation leverages tree-sitter to accurately parse *_test.go files, extracting both top-level TestXxx functions and t.Run subtests into a flat structure. The changes also include integrating Go language support into the core tree-sitter parser setup, along with a comprehensive suite of unit tests that cover numerous edge cases and ensure the parser's correctness.

The code is well-structured, adheres to the repository's Go coding conventions, and the refactoring in treesitter.go improves maintainability. I have one suggestion to optimize a loop in the parameter validation logic for better memory efficiency.

Add gotesting strategy for parsing Go test files (*_test.go)
- Extract func TestXxx(t *testing.T) format test functions
- Extract t.Run() subtests (flat structure)
- Integrate tree-sitter Go language support

fix #7
@kubrickcode kubrickcode merged commit aab136c into main Dec 4, 2025
1 check passed
@kubrickcode kubrickcode deleted the develop/shlee/7 branch December 4, 2025 01:27
@kubrickcode
Copy link
Member Author

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

go testing parsing feature

1 participant