fs := fakes.NewFakeFileSystem() fs.WriteFileString("/path/to/file", "contents")
func TestReadFile(t *testing.T) { fs := fakes.NewFakeFileSystem() fs.WriteFileString("/path/to/file", "contents") contents, err := ReadFile("/path/to/file", fs) if err != nil { t.Error("expected nil error, but got", err) } if contents != "contents" { t.Error("expected contents to be 'contents', but got", contents) } }In this example, we create a fake file system and write some contents to a file. We then call a function called `ReadFile` which takes a path and a file system as an argument, and we pass in our fake file system. We then check that the contents of the file are what we expect them to be. Overall, `FakeFileSystem` is a useful utility for writing tests that depend on file system interactions.