fork/gdu
git clone https://git.julia.blue/fork/gdu
8b8f1e9
ignore
1//go:build freebsd || darwin 2 3package device 4 5import ( 6"strings" 7"testing" 8 9"github.com/stretchr/testify/assert" 10) 11 12func TestZfsMountsShown (t * testing.T ) { 13mounts ,_ := readMountOutput (strings .NewReader (`/dev/ada0p2 on / (ufs, local, soft-updates) 14devfs on /dev (devfs) 15tmpfs on /tmp (tmpfs, local) 16fdescfs on /dev/fd (fdescfs) 17procfs on /proc (procfs, local) 18t on /t (zfs, local, nfsv4acls) 19t/db on /t/db (zfs, local, nfsv4acls) 20t/vm on /t/vm (zfs, local, nfsv4acls) 21t/log/pflog on /var/log/pflog (zfs, local, nfsv4acls) 22t/log on /t/log (zfs, local, nfsv4acls) 23devfs on /compat/linux/dev (devfs) 24fdescfs on /compat/linux/dev/fd (fdescfs) 25tmpfs on /compat/linux/dev/shm (tmpfs, local) 26map -hosts on /net (autofs) 27argon:/usr/src on /usr/src (nfs) 28argon:/usr/obj on /usr/obj (nfs)` )) 29 30devices ,err := processMounts (mounts ,true ) 31assert .Len (t ,devices ,6 ) 32assert .Nil (t ,err ) 33} 34 35func TestMountsWithSpace (t * testing.T ) { 36mounts ,err := readMountOutput (strings .NewReader ( 37`//inglor@vault.lan/volatile on /Users/inglor/Mountpoints/volatile (vault.lan) (smbfs, nodev, nosuid, mounted by inglor)` , 38 )) 39assert .Equal (t ,"//inglor@vault.lan/volatile" ,mounts [0 ].Name ) 40assert .Equal (t ,"/Users/inglor/Mountpoints/volatile (vault.lan)" ,mounts [0 ].MountPoint ) 41assert .Equal (t ,"smbfs" ,mounts [0 ].Fstype ) 42assert .Nil (t ,err ) 43}