diff options
Diffstat (limited to 'stdout')
-rw-r--r-- | stdout/stdout_linux_test.go | 27 | ||||
-rw-r--r-- | stdout/stdout_test.go | 10 |
2 files changed, 27 insertions, 10 deletions
diff --git a/stdout/stdout_linux_test.go b/stdout/stdout_linux_test.go new file mode 100644 index 0000000..3a287d2 --- /dev/null +++ b/stdout/stdout_linux_test.go @@ -0,0 +1,27 @@ +// +build linux + +package stdout + +import ( + "bytes" + "testing" + + log "github.com/sirupsen/logrus" + + "github.com/dundee/gdu/v5/pkg/device" + "github.com/stretchr/testify/assert" +) + +func init() { + log.SetLevel(log.WarnLevel) +} + +func TestShowDevicesWithErr(t *testing.T) { + output := bytes.NewBuffer(make([]byte, 10)) + + getter := device.LinuxDevicesInfoGetter{MountsPath: "/xyzxyz"} + ui := CreateStdoutUI(output, false, true, false) + err := ui.ListDevices(getter) + + assert.Contains(t, err.Error(), "no such file") +} diff --git a/stdout/stdout_test.go b/stdout/stdout_test.go index 25bb592..9ad6c8d 100644 --- a/stdout/stdout_test.go +++ b/stdout/stdout_test.go @@ -128,16 +128,6 @@ func TestShowDevicesWithColor(t *testing.T) { assert.Contains(t, output.String(), "xxx") } -func TestShowDevicesWithErr(t *testing.T) { - output := bytes.NewBuffer(make([]byte, 10)) - - getter := device.LinuxDevicesInfoGetter{MountsPath: "/xyzxyz"} - ui := CreateStdoutUI(output, false, true, false) - err := ui.ListDevices(getter) - - assert.Contains(t, err.Error(), "no such file") -} - func TestMaxInt(t *testing.T) { assert.Equal(t, 5, maxInt(2, 5)) assert.Equal(t, 4, maxInt(4, 2)) |