Documentation
¶
Overview ¶
Package fwtest provides test helpers for filewatcher v2.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeDirWatcher ¶
type FakeDirWatcher[T any] struct { // contains filtered or unexported fields }
FakeDirWatcher is an implementation of FileWatcher for testing with watching directories.
func NewFakeDirWatcher ¶
func NewFakeDirWatcher[T any](dir fs.FS, parser filewatcher.DirParser[T]) (*FakeDirWatcher[T], error)
NewFakeDirWatcher creates a FakeDirWatcher with the initial data and the given DirParser.
It provides Update function to update the data after it's been created.
func (*FakeDirWatcher[T]) Get ¶
func (dw *FakeDirWatcher[T]) Get() T
Get implements FileWatcher by returning the last updated data.
type FakeFileWatcher ¶
type FakeFileWatcher[T any] struct { // contains filtered or unexported fields }
FakeFileWatcher is an implementation of FileWatcher that does not actually read from a file, it simply returns the data given to it when it was initialized with NewFakeFilewatcher. It provides an additional Update method that allows you to update this data after it has been created.
func NewFakeFilewatcher ¶
func NewFakeFilewatcher[T any](r io.Reader, parser filewatcher.Parser[T]) (*FakeFileWatcher[T], error)
NewFakeFilewatcher returns a pointer to a new FakeFileWatcher object initialized with the given io.Reader and Parser.