MCPcopy
hub / github.com/golang/tools / TestParseCache_Reparsing

Function TestParseCache_Reparsing

gopls/internal/cache/parse_cache_test.go:87–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

85}
86
87func TestParseCache_Reparsing(t *testing.T) {
88 skipIfNoParseCache(t)
89
90 defer func(padding int) {
91 parsePadding = padding
92 }(parsePadding)
93 parsePadding = 0
94
95 files := dummyFileHandles(parseCacheMinFiles)
96 danglingSelector := []byte("package p\nfunc _() {\n\tx.\n}")
97 files = append(files, makeFakeFileHandle("file:///bad1", danglingSelector))
98 files = append(files, makeFakeFileHandle("file:///bad2", danglingSelector))
99
100 // Parsing should succeed even though we overflow the padding.
101 cache := newParseCache(0)
102 _, err := cache.parseFiles(context.Background(), token.NewFileSet(), parsego.Full, false, files...)
103 if err != nil {
104 t.Fatal(err)
105 }
106}
107
108// Re-parsing the first file should not panic.
109func TestParseCache_Issue59097(t *testing.T) {

Callers

nothing calls this directly

Calls 6

skipIfNoParseCacheFunction · 0.85
dummyFileHandlesFunction · 0.85
appendFunction · 0.85
makeFakeFileHandleFunction · 0.85
newParseCacheFunction · 0.85
parseFilesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…