github.com/MetalBlockchain/metalgo@v1.11.9/utils/filesystem/mock_file.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package filesystem 5 6 import "io/fs" 7 8 var _ fs.DirEntry = MockFile{} 9 10 // MockFile is an implementation of fs.File for unit testing. 11 type MockFile struct { 12 MockName string 13 MockIsDir bool 14 MockType fs.FileMode 15 MockInfo fs.FileInfo 16 MockInfoErr error 17 } 18 19 func (m MockFile) Name() string { 20 return m.MockName 21 } 22 23 func (m MockFile) IsDir() bool { 24 return m.MockIsDir 25 } 26 27 func (m MockFile) Type() fs.FileMode { 28 return m.MockType 29 } 30 31 func (m MockFile) Info() (fs.FileInfo, error) { 32 return m.MockInfo, m.MockInfoErr 33 }