diff options
author | Daniel Milde <daniel@milde.cz> | 2021-07-08 00:35:11 +0200 |
---|---|---|
committer | Daniel Milde <daniel@milde.cz> | 2021-07-08 00:35:11 +0200 |
commit | 80c4060dc9d9a642fae8172795d49f19bc067727 (patch) | |
tree | 7af3e881a3fbd0bd035e5a256f3d6fb39cf947bc | |
parent | 9d56c9c20f479e7bbc859f0b0bbef40d4d78f2ab (diff) |
stdout linux test moved to separate file
-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)) |