1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-30 15:13:55 +00:00

fs: make Flagger and FlaggerNP interfaces public so we can test flags elsewhere

This commit is contained in:
Nick Craig-Wood
2024-07-08 12:14:28 +01:00
parent e79273f9c9
commit 2e653f8128
12 changed files with 43 additions and 39 deletions

View File

@@ -5,31 +5,14 @@ import (
"fmt"
"testing"
"github.com/spf13/pflag"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// Interface which flags must satisfy - only defined for _test.go
// since we don't want to pull in pflag here
type flagger interface {
pflag.Value
json.Unmarshaler
}
// Interface which non-pointer flags must satisfy
//
// These are from pflag.Value and need to be non-pointer due the the
// way the backend flags are inserted into the flags.
type flaggerNP interface {
String() string
Type() string
}
// Check it satisfies the interfaces
var (
_ flagger = (*SizeSuffix)(nil)
_ flaggerNP = SizeSuffix(0)
_ Flagger = (*SizeSuffix)(nil)
_ FlaggerNP = SizeSuffix(0)
)
func TestSizeSuffixString(t *testing.T) {