1
0
mirror of https://github.com/rclone/rclone.git synced 2025-11-23 21:44:49 +02:00

b2: Add tests for new cleanup and cleanup-hidden backend commands.

This commit is contained in:
Pat Patterson
2024-02-29 16:49:34 -08:00
committed by Nick Craig-Wood
parent 92368f6d2b
commit 93c960df59
2 changed files with 252 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ package fstest
import (
"bytes"
"compress/gzip"
"context"
"flag"
"fmt"
@@ -609,3 +610,14 @@ func CheckDirModTime(ctx context.Context, t *testing.T, f fs.Fs, dir fs.Director
gotT := dir.ModTime(ctx)
AssertTimeEqualWithPrecision(t, dir.Remote(), wantT, gotT, f.Precision())
}
// Gz returns a compressed version of its input string
func Gz(t *testing.T, s string) string {
var buf bytes.Buffer
zw := gzip.NewWriter(&buf)
_, err := zw.Write([]byte(s))
require.NoError(t, err)
err = zw.Close()
require.NoError(t, err)
return buf.String()
}