Skip to content

test: add Go generics and Java enum method coverage tests#461

Merged
askpt merged 2 commits into
mainfrom
repo-assist/test-generics-and-enums-20260717-0c12bbf77d3b9f1e
Jul 17, 2026
Merged

test: add Go generics and Java enum method coverage tests#461
askpt merged 2 commits into
mainfrom
repo-assist/test-generics-and-enums-20260717-0c12bbf77d3b9f1e

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated pull request from Repo Assist.

Summary

Adds 6 new unit tests covering two behavioural gaps that were not exercised anywhere in the test suite:

  1. Go generic functions (Go 1.18+ type parameters) — verifies that generic type parameters ([T any], [T, U any], [T comparable]) are transparent to complexity analysis and that function names are extracted correctly
  2. Java enum methods — verifies that methods declared inside enum bodies receive the qualified EnumName.methodName format and that complexity is computed correctly for enum methods and constructors

Also updates samples/Test.java to include modern Java constructs (records, enums with methods, generic classes) for manual CodeLens verification.

New Tests

Go: Generic functions (3 tests)

Test Source Expected
Map[T, U any] with for-range for i, v := range slice complexity 1, name "Map"
Filter[T any] with for-range + nested if if pred(v) at nesting 1 complexity 3 (for+1, nested-if+2)
Identity[T] + Contains[T comparable] in same file 0 and 3 respectively

Java: Enum methods (3 tests)

Test Source Expected
Direction.isOpposite with if+&& chains 4 if statements + 4 && operators complexity 4, qualified name
Planet.Planet constructor + Planet.surfaceGravity trivial constructor + arithmetic 0 + 0, both qualified
Operation enum with abstract method + concrete override if (x==0 || y==0) complexity 2

Test Status

npm run compile   ✅  0 errors
npm run lint      ✅  0 warnings
npm run test:unit ✅  186 passing, 0 failing (was 180 before this PR)

Changes

  • src/unit/unit.test.ts — 6 new tests in two new describe blocks
  • samples/Test.java — added record Range, enum Direction, and class Container<T> sections at the top of the file

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • releaseassets.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "releaseassets.githubusercontent.com"

See Network Configuration for more information.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@1c6668b751c51af8571f01204ceffb19362e0f66

- Go generic functions: 3 tests covering Map[T,U]/Filter[T]/Identity[T]/Contains[T]
  patterns — verifies generic type parameters do not affect complexity analysis
- Java enum methods: 3 tests covering qualified name formatting (Direction.isOpposite,
  Planet.Planet, Planet.surfaceGravity) and enum with abstract method implementations
- samples/Test.java: add record, enum-with-methods, and generic-class sections for
  manual CodeLens verification of modern Java features (Java 16+)
- Total tests: 180 → 186 (all passing)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@askpt askpt changed the title [repo-assist] test: add Go generics and Java enum method coverage tests test: add Go generics and Java enum method coverage tests Jul 17, 2026
@askpt
askpt marked this pull request as ready for review July 17, 2026 14:27
@askpt
askpt self-requested a review as a code owner July 17, 2026 14:27
Copilot AI review requested due to automatic review settings July 17, 2026 14:27
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.50%. Comparing base (c7da834) to head (f479ef1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #461   +/-   ##
=======================================
  Coverage   81.50%   81.50%           
=======================================
  Files          13       13           
  Lines        4265     4265           
  Branches      428      429    +1     
=======================================
  Hits         3476     3476           
  Misses        787      787           
  Partials        2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds new unit-test coverage for language constructs that previously weren’t exercised by the metrics analyzers (Go 1.18+ generics and Java enum-declared methods/constructors), plus updates the Java sample file for manual VS Code CodeLens verification.

Changes:

  • Added Go unit tests verifying generic type parameters don’t affect function name extraction or cognitive complexity calculation.
  • Added Java unit tests verifying enum method/constructor qualification (EnumName.methodName) and expected complexity increments.
  • Extended samples/Test.java with modern Java constructs (records, enums with methods, generic classes) for manual inspection.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/unit/unit.test.ts Adds 6 new unit tests for Go generics and Java enum methods/constructors.
samples/Test.java Updates the Java sample file with modern constructs for manual CodeLens verification.

Comment thread src/unit/unit.test.ts
@askpt

askpt commented Jul 17, 2026

Copy link
Copy Markdown
Owner

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply the suggestion exactly.

Do not make changes beyond what is described in the linked review thread.

…precisely

Co-authored-by: askpt <2493377+askpt@users.noreply.github.com>

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply t...

Fixed in 3059978. The test now:

  1. Asserts results.length === 2 — verifying the abstract method is skipped and exactly two concrete implementations are reported
  2. Checks every result has name "Operation.apply" — verifying the enum name qualification
  3. Finds ADD.apply by complexity === 0 and MULTIPLY.apply by complexity === 2 — selecting each implementation by its expected complexity rather than the first non-zero result

Copilot finished work on behalf of askpt July 17, 2026 14:35
@askpt
askpt enabled auto-merge (squash) July 17, 2026 14:42
@askpt
askpt merged commit bfc7a97 into main Jul 17, 2026
9 checks passed
@askpt
askpt deleted the repo-assist/test-generics-and-enums-20260717-0c12bbf77d3b9f1e branch July 17, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants