File: dev_bsd_test.go

package info (click to toggle)
gdu 5.34.2-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 1,288 kB
  • sloc: makefile: 145
file content (21 lines) | stat: -rw-r--r-- 528 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//go:build freebsd || openbsd || netbsd || darwin

package device

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestGetDevicesInfo(t *testing.T) {
	getter := BSDDevicesInfoGetter{MountCmd: "/sbin/mount"}
	devices, _ := getter.GetDevicesInfo()
	assert.IsType(t, Devices{}, devices)
}

func TestGetDevicesInfoFail(t *testing.T) {
	getter := BSDDevicesInfoGetter{MountCmd: "/nonexistent"}
	_, err := getter.GetDevicesInfo()
	assert.Equal(t, "fork/exec /nonexistent: no such file or directory", err.Error())
}