| 24 | ) |
| 25 | |
| 26 | func 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 | } |