MCPcopy Index your code
hub / github.com/coder/coder / TestEngine_SearchFuzzyMatch

Function TestEngine_SearchFuzzyMatch

agent/filefinder/engine_test.go:52–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestEngine_SearchFuzzyMatch(t *testing.T) {
53 t.Parallel()
54 dir := t.TempDir()
55 createFile(t, dir, "src/controllers/user_handler.go", "package controllers")
56 createFile(t, dir, "src/models/user.go", "package models")
57 createFile(t, dir, "docs/api.md", "# API")
58
59 eng, ctx := newTestEngine(t)
60 require.NoError(t, eng.AddRoot(ctx, dir))
61
62 // "handler" should match "user_handler.go".
63 results, err := eng.Search(ctx, "handler", filefinder.DefaultSearchOptions())
64 require.NoError(t, err)
65 // The query is a subsequence of "user_handler.go" so it
66 // should appear somewhere in the results.
67 requireResultHasPath(t, results, "src/controllers/user_handler.go")
68}
69
70func TestEngine_IndexPicksUpNewFile(t *testing.T) {
71 t.Parallel()

Callers

nothing calls this directly

Calls 7

DefaultSearchOptionsFunction · 0.92
newTestEngineFunction · 0.85
requireResultHasPathFunction · 0.85
AddRootMethod · 0.80
SearchMethod · 0.80
createFileFunction · 0.70
TempDirMethod · 0.65

Tested by

no test coverage detected