diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2026-01-19 15:31:50 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2026-01-21 13:38:45 +0000 |
| commit | d720635adb8965149cd75a3da692d3a0480c36c9 (patch) | |
| tree | d9896eabd70abd266028624702bc74609ba1c9e4 /pkg/codesearch/codesearch_test.go | |
| parent | 6984f21fcb77bdd034a489c0e552aa1d910e852f (diff) | |
pkg/codesearch: support searching for references
Extend codesearch clang tool to export info about function references
(calls, takes-address-of).
Add pkg/codesearch command find-references.
Export find-references in pkg/aflow/tools/codesearcher to LLMs.
Update #6469
Diffstat (limited to 'pkg/codesearch/codesearch_test.go')
| -rw-r--r-- | pkg/codesearch/codesearch_test.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/pkg/codesearch/codesearch_test.go b/pkg/codesearch/codesearch_test.go index 1f353c804..85dc90e00 100644 --- a/pkg/codesearch/codesearch_test.go +++ b/pkg/codesearch/codesearch_test.go @@ -47,16 +47,24 @@ func testCommand(t *testing.T, index *Index, covered map[string]bool, file strin t.Fatal(err) } query, _, _ := bytes.Cut(data, []byte{'\n'}) - args := strings.Fields(string(query)) - if len(args) == 0 { + fields := strings.Fields(string(query)) + if len(fields) == 0 { t.Fatal("no command found") } - result, err := index.Command(args[0], args[1:]) + cmd := fields[0] + var args []string + for _, arg := range fields[1:] { + if arg == `""` { + arg = "" + } + args = append(args, arg) + } + result, err := index.Command(cmd, args) if err != nil { // This is supposed to test aflow.BadCallError messages. result = err.Error() + "\n" } - got := append([]byte(strings.Join(args, " ")+"\n\n"), result...) + got := append([]byte(strings.Join(fields, " ")+"\n\n"), result...) tooltest.CompareGoldenData(t, file, got) - covered[args[0]] = true + covered[cmd] = true } |
