fs_test.go — gin Source File
Architecture documentation for fs_test.go, a go file in the gin codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9e085b07_bed4_2167_e369_c9dd053f0655["fs_test.go"] 285f3da5_b453_bac8_eb53_efea9feb6bb9["errors"] 9e085b07_bed4_2167_e369_c9dd053f0655 --> 285f3da5_b453_bac8_eb53_efea9feb6bb9 style 9e085b07_bed4_2167_e369_c9dd053f0655 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package fs
import (
"errors"
"net/http"
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
type mockFileSystem struct {
open func(name string) (http.File, error)
}
func (m *mockFileSystem) Open(name string) (http.File, error) {
return m.open(name)
}
func TestFileSystem_Open(t *testing.T) {
var testFile *os.File
mockFS := &mockFileSystem{
open: func(name string) (http.File, error) {
return testFile, nil
},
}
fs := &FileSystem{mockFS}
file, err := fs.Open("foo")
require.NoError(t, err)
assert.Equal(t, testFile, file)
}
func TestFileSystem_Open_err(t *testing.T) {
testError := errors.New("mock")
mockFS := &mockFileSystem{
open: func(_ string) (http.File, error) {
return nil, testError
},
}
fs := &FileSystem{mockFS}
file, err := fs.Open("foo")
require.ErrorIs(t, err, testError)
assert.Nil(t, file)
}
Domain
Subdomains
Classes
Types
Dependencies
- errors
Source
Frequently Asked Questions
What does fs_test.go do?
fs_test.go is a source file in the gin codebase, written in go. It belongs to the InternalUtilities domain, FileSystem subdomain.
What functions are defined in fs_test.go?
fs_test.go defines 3 function(s): TestFileSystem_Open, TestFileSystem_Open_err, name.
What does fs_test.go depend on?
fs_test.go imports 1 module(s): errors.
Where is fs_test.go in the architecture?
fs_test.go is located at internal/fs/fs_test.go (domain: InternalUtilities, subdomain: FileSystem, directory: internal/fs).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free