fstest

package module
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 9 Imported by: 0

README

fstest build status Go Report Card Go Reference

Go library extending functionalities of the standard fs/fstest package

Documentation

Overview

Package fstest is a drop-in replacement for the standard testing/fstest package which adds a few extensions that have proven useful when testing implementations of the fs.FS interface.

For a full documentation of the standard testing/fs package see: https://pkg.go.dev/testing/fstest

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualFS

func EqualFS(a, b fs.FS) error

EqualFS compares two file systems, returning nil if they are equal, or an error describing their difference when they are not.

func EqualFSBuffer

func EqualFSBuffer(a, b fs.FS, buf []byte) error

EqualFSBuffer is like EqualFS but the function receives the buffer used to read files as arguments.

func TestFS

func TestFS(fsys fs.FS, expected ...string) error

Types

type MapFS

type MapFS fstest.MapFS

func (MapFS) Glob

func (fsys MapFS) Glob(pattern string) ([]string, error)

func (MapFS) Open

func (fsys MapFS) Open(name string) (fs.File, error)

func (MapFS) ReadDir

func (fsys MapFS) ReadDir(name string) ([]fs.DirEntry, error)

func (MapFS) ReadFile

func (fsys MapFS) ReadFile(name string) ([]byte, error)
func (fsys MapFS) ReadLink(name string) (string, error)

func (MapFS) Stat

func (fsys MapFS) Stat(name string) (fs.FileInfo, error)

func (MapFS) Sub

func (fsys MapFS) Sub(name string) (fs.FS, error)

type MapFile

type MapFile = fstest.MapFile

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL