package main import ( "testing" "github.com/shirou/gopsutil/v4/disk" ) func TestShouldSkipDiskPartition(t *testing.T) { tests := []struct { name string part disk.PartitionStat want bool }{ { name: "keep local apfs root volume", part: disk.PartitionStat{ Device: "/dev/disk3s1s1", Mountpoint: "/", Fstype: "apfs", }, want: false, }, { name: "skip macfuse mirror mount", part: disk.PartitionStat{ Device: "kaku-local:/", Mountpoint: "/Users/tw93/Library/Caches/dev.kaku/sshfs/kaku-local", Fstype: "macfuse", }, want: true, }, { name: "skip smb share", part: disk.PartitionStat{ Device: "//server/share", Mountpoint: "/Volumes/share", Fstype: "smbfs", }, want: true, }, { name: "skip system volume", part: disk.PartitionStat{ Device: "/dev/disk3s5", Mountpoint: "/System/Volumes/Data", Fstype: "apfs", }, want: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := shouldSkipDiskPartition(tt.part); got != tt.want { t.Fatalf("shouldSkipDiskPartition(%+v) = %v, want %v", tt.part, got, tt.want) } }) } }