mirror of
https://github.com/restic/restic.git
synced 2025-05-16 19:18:30 +00:00

The tests are now split into individual files for each command. The separation isn't perfect as many tests make use of multiple commands. In particular `init`, `backup`, `check` and `list` are used by a larger number of test cases. Most tests now reside in files name cmd_<name>_integration_test.go. This provides a certain indication which commands have significant test coverage.
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")
|
|
}
|