1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

fs: Implement Scan method for SizeSuffix and Duration

This commit is contained in:
Nick Craig-Wood
2018-05-14 16:32:27 +01:00
parent 028f8a69d3
commit 1c80e84f8a
4 changed files with 75 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package fs
import (
"fmt"
"testing"
"github.com/spf13/pflag"
@@ -93,3 +94,11 @@ func TestSizeSuffixSet(t *testing.T) {
assert.Equal(t, test.want, int64(ss))
}
}
func TestSizeSuffixScan(t *testing.T) {
var v SizeSuffix
n, err := fmt.Sscan(" 17M ", &v)
require.NoError(t, err)
assert.Equal(t, 1, n)
assert.Equal(t, SizeSuffix(17<<20), v)
}