788857d2c3
remove unneeded panics improve error handling add tests fix error checking that was comparing for exact values sort imports
21 lines
360 B
Go
21 lines
360 B
Go
package util
|
|
|
|
import (
|
|
"os/user"
|
|
"testing"
|
|
)
|
|
|
|
func TestGetUsedSpace(t *testing.T) {
|
|
usr, err := user.Current()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
usedPctile, err := GetUsedSpace(usr.HomeDir + "/.lbrynet/blobfiles/")
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
if usedPctile > 1 {
|
|
t.Errorf("over 1: %.2f", usedPctile)
|
|
}
|
|
t.Logf("used space: %.2f", usedPctile)
|
|
}
|