Skip to content

Package internal/storage/testutil

Import path: go.devnw.com/canary/internal/storage/testutil

package testutil // import "go.devnw.com/canary/internal/storage/testutil"

API (raw go doc)


package testutil // import "go.devnw.com/canary/internal/storage/testutil"

CANARY: REQ=CBIN-146; FEATURE="TestInfrastructure"; ASPECT=Storage; STATUS=IMPL;
UPDATED=2025-10-18

FUNCTIONS

func Chdir(t *testing.T, dir string) func()
    Chdir changes to a directory and returns a cleanup function to restore

func FileExists(path string) bool
    FileExists checks if a file exists at the given path

func SetupProjectDir(t *testing.T, dir string) error
    SetupProjectDir creates a project directory with .canary subdirectory

func TempDir(t *testing.T) (string, func())
    TempDir creates a temporary directory for testing Returns the path and a
    cleanup function

func TempDirB(b *testing.B) (string, func())
    TempDirB creates a temporary directory for benchmarking Returns the path and
    a cleanup function

func TempHomeDir(t *testing.T) (string, func())
    TempHomeDir creates a temporary HOME directory for testing Returns the
    original HOME value and a cleanup function

func TempHomeDirB(b *testing.B) (string, func())
    TempHomeDirB creates a temporary HOME directory for benchmarking Returns the
    original HOME value and a cleanup function


TYPES

type TB interface {
    Helper()
    Fatalf(format string, args ...interface{})
}
    TB is an interface that covers both *testing.T and *testing.B