MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / TestNewInternalLogger_EmptyCacheDir

Function TestNewInternalLogger_EmptyCacheDir

internal/logger/logger_test.go:169–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestNewInternalLogger_EmptyCacheDir(t *testing.T) {
170 // Create a temporary directory for this test to avoid creating files in current directory
171 tempDir := t.TempDir()
172
173 // Change to temp directory temporarily
174 originalDir, err := os.Getwd()
175 require.NoError(t, err)
176
177 defer func() {
178 if chdirErr := os.Chdir(originalDir); chdirErr != nil {
179 t.Errorf("Failed to change back to original directory: %v", chdirErr)
180 }
181 }()
182
183 err = os.Chdir(tempDir)
184 require.NoError(t, err)
185
186 logger, err := NewInternalLogger(LevelInfo, "")
187 require.NoError(t, err)
188 assert.NotNil(t, logger)
189
190 defer logger.Close()
191}
192
193func TestNewInternalLogger_InvalidCacheDir(t *testing.T) {
194 // Create a temporary directory for this test to avoid creating files in current directory

Callers

nothing calls this directly

Calls 2

NewInternalLoggerFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected