mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-26 08:38:18 +03:00
24 lines
633 B
Go
24 lines
633 B
Go
|
package aghtest
|
||
|
|
||
|
// FSWatcher is a mock aghos.FSWatcher implementation to use in tests.
|
||
|
type FSWatcher struct {
|
||
|
OnEvents func() (e <-chan struct{})
|
||
|
OnAdd func(name string) (err error)
|
||
|
OnClose func() (err error)
|
||
|
}
|
||
|
|
||
|
// Events implements the aghos.FSWatcher interface for *FSWatcher.
|
||
|
func (w *FSWatcher) Events() (e <-chan struct{}) {
|
||
|
return w.OnEvents()
|
||
|
}
|
||
|
|
||
|
// Add implements the aghos.FSWatcher interface for *FSWatcher.
|
||
|
func (w *FSWatcher) Add(name string) (err error) {
|
||
|
return w.OnAdd(name)
|
||
|
}
|
||
|
|
||
|
// Close implements the aghos.FSWatcher interface for *FSWatcher.
|
||
|
func (w *FSWatcher) Close() (err error) {
|
||
|
return w.OnClose()
|
||
|
}
|