MCPcopy Index your code
hub / github.com/livebud/bud / TestModuleFindFromFS

Function TestModuleFindFromFS

package/gomod/mod_test.go:229–249  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

227}
228
229func TestModuleFindFromFS(t *testing.T) {
230 is := is.New(t)
231 wd, err := os.Getwd()
232 is.NoErr(err)
233 module1, err := gomod.Find(wd)
234 is.NoErr(err)
235 // First ensure the package doesn't exist
236 module2, err := module1.Find(module1.Import("imagine"))
237 is.Equal(nil, module2)
238 is.True(errors.Is(err, fs.ErrNotExist))
239 // Now find the package using a virtual FS
240 vfs := vfs.Map{
241 "imagine/imagine.go": []byte(`package imagine`),
242 }
243 module2, err = module1.FindIn(vfs, module1.Import("imagine"))
244 is.NoErr(err)
245 is.Equal(module1.Directory(), module2.Directory())
246 absDir, err := module2.ResolveDirectoryIn(vfs, module1.Import("imagine"))
247 is.NoErr(err)
248 is.Equal(module1.Directory("imagine"), absDir)
249}
250
251func TestSubFS(t *testing.T) {
252 is := is.New(t)

Callers

nothing calls this directly

Calls 11

NewFunction · 0.92
FindFunction · 0.92
NoErrMethod · 0.80
EqualMethod · 0.80
TrueMethod · 0.80
IsMethod · 0.80
FindInMethod · 0.80
ResolveDirectoryInMethod · 0.80
FindMethod · 0.65
ImportMethod · 0.45
DirectoryMethod · 0.45

Tested by

no test coverage detected