mirror of
https://github.com/rclone/rclone.git
synced 2025-08-09 05:54:43 +02:00
Add lib/diskusage to measure used/free on disks
This commit is contained in:
23
lib/diskusage/diskusage_test.go
Normal file
23
lib/diskusage/diskusage_test.go
Normal file
@ -0,0 +1,23 @@
|
||||
package diskusage
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
info, err := New(".")
|
||||
if err == ErrUnsupported {
|
||||
t.Skip(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
t.Logf("Free %16d", info.Free)
|
||||
t.Logf("Available %16d", info.Available)
|
||||
t.Logf("Total %16d", info.Total)
|
||||
assert.True(t, info.Total != 0)
|
||||
assert.True(t, info.Total > info.Free)
|
||||
assert.True(t, info.Total > info.Available)
|
||||
assert.True(t, info.Free >= info.Available)
|
||||
}
|
Reference in New Issue
Block a user