Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
Docs [Golang] [Package] FileSystem Mock (#31)
Browse files Browse the repository at this point in the history
* Docs [Golang] [Package] FileSystem Mock

- [+] refactor(file_system_mock.go): reformat code and add comments to mockFileInfo methods

* Docs [Golang] [Package] FileSystem Mock Code Comment

- [+] chore(file_system_mock.go): remove commented out code
- [+] chore(file_system_mock.go): remove unnecessary comment
  • Loading branch information
H0llyW00dzZ authored Dec 11, 2023
1 parent 371884c commit 6275c7f
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions filesystem/file_system_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ func (m *MockFileSystem) FileExists(name string) (bool, error) {
return exists, nil
}

// Implement the Close method if needed for testing
func (mf *MockFileSystem) Close() error {
// Implement the Close method if needed for testing
return nil
}

Expand All @@ -164,9 +164,32 @@ func (mf *MockFile) Seek(offset int64, whence int) (int64, error) {
return 0, nil // No-op for the mock.
}

func (m mockFileInfo) Name() string { return m.name }
func (m mockFileInfo) Size() int64 { return 0 } // Dummy value for size.
func (m mockFileInfo) Mode() fs.FileMode { return 0 } // Dummy value for file mode.
func (m mockFileInfo) ModTime() time.Time { return time.Time{} } // Dummy value for modification time.
func (m mockFileInfo) IsDir() bool { return false } // Dummy value, always false.
func (m mockFileInfo) Sys() interface{} { return nil } // No system-specific information.
// Name returns the file name.
func (m mockFileInfo) Name() string {
return m.name
}

// Size returns the size of the file.
func (m mockFileInfo) Size() int64 {
return 0 // Dummy value for size.
}

// Mode returns the file mode.
func (m mockFileInfo) Mode() fs.FileMode {
return 0 // Dummy value for file mode.
}

// ModTime returns the modification time of the file.
func (m mockFileInfo) ModTime() time.Time {
return time.Time{} // Dummy value for modification time.
}

// IsDir reports whether the file is a directory.
func (m mockFileInfo) IsDir() bool {
return false // Dummy value, always false.
}

// Sys returns the underlying data source (can return nil).
func (m mockFileInfo) Sys() interface{} {
return nil // No system-specific information.
}

0 comments on commit 6275c7f

Please sign in to comment.