MCPcopy Create free account
hub / github.com/bufbuild/buf / requireModuleContainFileNames

Function requireModuleContainFileNames

private/buf/bufworkspace/workspace_test.go:408–419  ·  view source on GitHub ↗
(t *testing.T, module bufmodule.Module, expectedFileNames ...string)

Source from the content-addressed store, hash-verified

406}
407
408func requireModuleContainFileNames(t *testing.T, module bufmodule.Module, expectedFileNames ...string) {
409 fileNamesToBeSeen := xslices.ToStructMap(expectedFileNames)
410 require.NoError(t, module.WalkFileInfos(t.Context(), func(fi bufmodule.FileInfo) error {
411 path := fi.Path()
412 if _, ok := fileNamesToBeSeen[path]; !ok {
413 return fmt.Errorf("module has unexpected file: %s", path)
414 }
415 delete(fileNamesToBeSeen, path)
416 return nil
417 }))
418 require.Emptyf(t, fileNamesToBeSeen, "expect %s from module", xstrings.JoinSliceQuoted(xslices.MapKeysToSlice(fileNamesToBeSeen), ","))
419}
420
421func requireModuleFileContent(
422 t *testing.T,

Callers 1

TestDuplicatePathFunction · 0.85

Calls 2

WalkFileInfosMethod · 0.65
PathMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…