mirror of
https://github.com/restic/restic.git
synced 2025-05-17 01:48:21 +00:00
29 lines
543 B
Go
29 lines
543 B
Go
![]() |
package main
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"context"
|
||
|
"os"
|
||
|
"strings"
|
||
|
"testing"
|
||
|
|
||
|
rtest "github.com/restic/restic/internal/test"
|
||
|
)
|
||
|
|
||
|
func testRunLs(t testing.TB, gopts GlobalOptions, snapshotID string) []string {
|
||
|
buf := bytes.NewBuffer(nil)
|
||
|
globalOptions.stdout = buf
|
||
|
quiet := globalOptions.Quiet
|
||
|
globalOptions.Quiet = true
|
||
|
defer func() {
|
||
|
globalOptions.stdout = os.Stdout
|
||
|
globalOptions.Quiet = quiet
|
||
|
}()
|
||
|
|
||
|
opts := LsOptions{}
|
||
|
|
||
|
rtest.OK(t, runLs(context.TODO(), opts, gopts, []string{snapshotID}))
|
||
|
|
||
|
return strings.Split(buf.String(), "\n")
|
||
|
}
|