shirou_gopsutil/disk_test.go

31 lines
469 B
Go

package gopsutil
import (
"encoding/json"
"fmt"
"runtime"
"testing"
)
func TestDisk_usage(t *testing.T) {
path := "/"
if runtime.GOOS == "windows" {
path = "C:"
}
v, err := Disk_usage(path)
if err != nil {
t.Errorf("error %v", err)
}
d, _ := json.Marshal(v)
fmt.Printf("%s\n", d)
}
func TestDisk_partitions(t *testing.T) {
v, err := Disk_partitions()
if err != nil {
t.Errorf("error %v", err)
}
d, _ := json.Marshal(v)
fmt.Printf("%s\n", d)
}