Files
zzet--gortex/internal/indexer/codegen_annotations_test.go
wehub-resource-sync a06f331eb8
install-script / powershell-syntax (push) Waiting to run
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
install-script / install (macos-14) (push) Waiting to run
install-script / install (ubuntu-latest) (push) Waiting to run
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:33:42 +08:00

52 lines
1.3 KiB
Go

package indexer
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
"github.com/zzet/gortex/internal/config"
"github.com/zzet/gortex/internal/graph"
"github.com/zzet/gortex/internal/parser"
"github.com/zzet/gortex/internal/parser/languages"
)
// TestIndex_LombokGeneratedVisibility indexes a real Lombok @Data class
// and verifies the indexer flags it as carrying generated members.
func TestIndex_LombokGeneratedVisibility(t *testing.T) {
dir := t.TempDir()
writeFile(t, filepath.Join(dir, "User.java"), `package demo;
import lombok.Data;
@Data
public class User {
private String name;
private int age;
}
`)
g := graph.New()
reg := parser.NewRegistry()
reg.Register(languages.NewJavaExtractor())
idx := New(g, reg, config.Default().Index, zap.NewNop())
_, err := idx.Index(dir)
require.NoError(t, err)
var marked *graph.Node
for _, n := range g.AllNodes() {
if n.Meta == nil {
continue
}
if v, _ := n.Meta["has_generated_members"].(bool); v {
marked = n
break
}
}
require.NotNil(t, marked, "the @Data class must be flagged with generated members")
require.Equal(t, "User", marked.Name)
require.Equal(t, "lombok", marked.Meta["codegen_tool"])
require.Contains(t, marked.Meta["generated_members"].([]string), "getters")
}