MCPcopy Index your code
hub / github.com/dnote/dnote / TestEnsureDir

Function TestEnsureDir

pkg/cli/utils/files_test.go:26–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestEnsureDir(t *testing.T) {
27 tmpDir := t.TempDir()
28 testPath := filepath.Join(tmpDir, "test", "nested", "dir")
29
30 // Create directory
31 err := EnsureDir(testPath)
32 assert.Equal(t, err, nil, "EnsureDir should succeed")
33
34 // Verify it exists
35 info, err := os.Stat(testPath)
36 assert.Equal(t, err, nil, "directory should exist")
37 assert.Equal(t, info.IsDir(), true, "should be a directory")
38
39 // Call again on existing directory - should not error
40 err = EnsureDir(testPath)
41 assert.Equal(t, err, nil, "EnsureDir should succeed on existing directory")
42}

Callers

nothing calls this directly

Calls 2

EqualFunction · 0.92
EnsureDirFunction · 0.85

Tested by

no test coverage detected