Add testing
This commit is contained in:
parent
3233f8c27f
commit
06e6d457da
14 changed files with 273 additions and 5 deletions
|
@ -14,6 +14,10 @@ type FSWrapper struct {
|
|||
log bool
|
||||
}
|
||||
|
||||
// Compile time interface implementation assertion
|
||||
var _ fs.FS = &FSWrapper{}
|
||||
|
||||
// No test, as no processing happens, only wrapping the arguments in a struct
|
||||
func NewFSWrapper(wraps fs.FS, appends string, logAccess bool) *FSWrapper {
|
||||
return &FSWrapper{
|
||||
wrapped: wraps,
|
||||
|
@ -22,11 +26,12 @@ func NewFSWrapper(wraps fs.FS, appends string, logAccess bool) *FSWrapper {
|
|||
}
|
||||
}
|
||||
|
||||
func (fs *FSWrapper) Open(name string) (fs.File, error) {
|
||||
res, err := fs.wrapped.Open(fs.toAdd + name)
|
||||
if fs.log {
|
||||
// Pretty sure this can't be reliably tested
|
||||
func (fw *FSWrapper) Open(name string) (fs.File, error) {
|
||||
res, err := fw.wrapped.Open(fw.toAdd + name)
|
||||
if fw.log {
|
||||
log.Debug().
|
||||
Str("prefix", fs.toAdd).
|
||||
Str("prefix", fw.toAdd).
|
||||
Str("filename", name).
|
||||
Err(err).
|
||||
Msg("fswrapper: File access result")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue