// Generated by Lisette bindgen
// Source: testing/fstest (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.14

import "go:io/fs"
import "go:time"

/// TestFS tests a file system implementation.
/// It walks the entire tree of files in fsys,
/// opening and checking that each file behaves correctly.
/// Symbolic links are not followed,
/// but their Lstat values are checked
/// if the file system implements [fs.ReadLinkFS].
/// It also checks that the file system contains at least the expected files.
/// As a special case, if no expected files are listed, fsys must be empty.
/// Otherwise, fsys must contain at least the listed files; it can also contain others.
/// The contents of fsys must not change concurrently with TestFS.
/// 
/// If TestFS finds any misbehaviors, it returns either the first error or a
/// list of errors. Use [errors.Is] or [errors.As] to inspect.
/// 
/// Typical usage inside a test is:
/// 
/// 	if err := fstest.TestFS(myFS, "file/that/should/be/present"); err != nil {
/// 		t.Fatal(err)
/// 	}
pub fn TestFS(fsys: fs.FS, expected: VarArgs<string>) -> Result<(), error>

/// A MapFS is a simple in-memory file system for use in tests,
/// represented as a map from path names (arguments to Open)
/// to information about the files, directories, or symbolic links they represent.
/// 
/// The map need not include parent directories for files contained
/// in the map; those will be synthesized if needed.
/// But a directory can still be included by setting the [MapFile.Mode]'s [fs.ModeDir] bit;
/// this may be necessary for detailed control over the directory's [fs.FileInfo]
/// or to create an empty directory.
/// 
/// File system operations read directly from the map,
/// so that the file system can be changed by editing the map as needed.
/// An implication is that file system operations must not run concurrently
/// with changes to the map, which would be a race.
/// Another implication is that opening or reading a directory requires
/// iterating over the entire map, so a MapFS should typically be used with not more
/// than a few hundred entries or directory reads.
pub struct MapFS(Map<string, Ref<MapFile>>)

/// A MapFile describes a single file in a [MapFS].
pub struct MapFile {
  pub Data: Slice<uint8>,
  pub Mode: fs.FileMode,
  pub ModTime: time.Time,
  pub Sys: Unknown,
}

impl MapFS {
  fn Glob(self, pattern: string) -> Result<Slice<string>, error>

  /// Lstat returns a FileInfo describing the named file.
  /// If the file is a symbolic link, the returned FileInfo describes the symbolic link.
  /// Lstat makes no attempt to follow the link.
  fn Lstat(self, name: string) -> Result<fs.FileInfo, error>

  /// Open opens the named file after following any symbolic links.
  fn Open(self, name: string) -> Result<fs.File, error>

  fn ReadDir(self, name: string) -> Result<Slice<fs.DirEntry>, error>

  fn ReadFile(self, name: string) -> Result<Slice<uint8>, error>

  /// ReadLink returns the destination of the named symbolic link.
  fn ReadLink(self, name: string) -> Result<string, error>

  fn Stat(self, name: string) -> Result<fs.FileInfo, error>

  fn Sub(self, dir: string) -> Result<fs.FS, error>
}
