github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/fs/logger/logger_test.go (about) 1 //go:build !plan9 2 // +build !plan9 3 4 package logger_test 5 6 import ( 7 "os" 8 "path/filepath" 9 "testing" 10 11 "github.com/rclone/rclone/fs/logger" 12 "github.com/rogpeppe/go-internal/testscript" 13 ) 14 15 // TestMain drives the tests 16 func TestMain(m *testing.M) { 17 // This enables the testscript package. See: 18 // https://bitfieldconsulting.com/golang/cli-testing 19 // https://pkg.go.dev/github.com/rogpeppe/go-internal@v1.11.0/testscript 20 os.Exit(testscript.RunMain(m, map[string]func() int{ 21 "rclone": logger.Main, 22 })) 23 } 24 25 func TestLogger(t *testing.T) { 26 // Usage: https://bitfieldconsulting.com/golang/cli-testing 27 28 testscript.Run(t, testscript.Params{ 29 Dir: "testdata/script", 30 Setup: func(env *testscript.Env) error { 31 env.Setenv("SRC", filepath.Join("$WORK", "src")) 32 env.Setenv("DST", filepath.Join("$WORK", "dst")) 33 return nil 34 }, 35 }) 36 }