Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dundee committed Feb 14, 2021
1 parent 6c26fd5 commit 3fc16a1
Showing 1 changed file with 70 additions and 9 deletions.
79 changes: 70 additions & 9 deletions cmd/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,28 @@ func TestVersion(t *testing.T) {

buff := bytes.NewBuffer(make([]byte, 10))

Run(&RunFlags{ShowVersion: true}, []string{}, false, buff, testapp.CreateMockedApp(false), testdev.DevicesInfoGetterMock{})
Run(
&RunFlags{ShowVersion: true},
[]string{},
false,
buff,
testapp.CreateMockedApp(false),
testdev.DevicesInfoGetterMock{},
)

assert.Contains(t, buff.String(), "Version:\t development")
}

func TestLogError(t *testing.T) {
buff := bytes.NewBuffer(make([]byte, 10))
err := Run(&RunFlags{LogFile: "/xyzxyz"}, []string{}, false, buff, testapp.CreateMockedApp(false), testdev.DevicesInfoGetterMock{})
err := Run(
&RunFlags{LogFile: "/xyzxyz"},
[]string{},
false,
buff,
testapp.CreateMockedApp(false),
testdev.DevicesInfoGetterMock{},
)

assert.Contains(t, err.Error(), "permission denied")
}
Expand All @@ -33,7 +47,14 @@ func TestAnalyzePath(t *testing.T) {

buff := bytes.NewBuffer(make([]byte, 10))

Run(&RunFlags{LogFile: "/dev/null"}, []string{"test_dir"}, false, buff, testapp.CreateMockedApp(false), testdev.DevicesInfoGetterMock{})
Run(
&RunFlags{LogFile: "/dev/null"},
[]string{"test_dir"},
false,
buff,
testapp.CreateMockedApp(false),
testdev.DevicesInfoGetterMock{},
)

assert.Contains(t, buff.String(), "nested")
}
Expand All @@ -44,7 +65,13 @@ func TestAnalyzePathWithGui(t *testing.T) {

buff := bytes.NewBuffer(make([]byte, 10))

Run(&RunFlags{LogFile: "/dev/null"}, []string{"test_dir"}, true, buff, testapp.CreateMockedApp(false), testdev.DevicesInfoGetterMock{})
Run(
&RunFlags{LogFile: "/dev/null"},
[]string{"test_dir"},
true,
buff,
testapp.CreateMockedApp(false), testdev.DevicesInfoGetterMock{},
)
}

func TestNoCross(t *testing.T) {
Expand All @@ -53,7 +80,14 @@ func TestNoCross(t *testing.T) {

buff := bytes.NewBuffer(make([]byte, 10))

Run(&RunFlags{LogFile: "/dev/null", NoCross: true}, []string{"test_dir"}, false, buff, testapp.CreateMockedApp(false), testdev.DevicesInfoGetterMock{})
Run(
&RunFlags{LogFile: "/dev/null", NoCross: true},
[]string{"test_dir"},
false,
buff,
testapp.CreateMockedApp(false),
testdev.DevicesInfoGetterMock{},
)

assert.Contains(t, buff.String(), "nested")
}
Expand All @@ -65,7 +99,14 @@ func TestNoCrossWithErr(t *testing.T) {
buff := bytes.NewBuffer(make([]byte, 10))

getter := device.LinuxDevicesInfoGetter{MountsPath: "/xxxyyy"}
err := Run(&RunFlags{LogFile: "/dev/null", NoCross: true}, []string{"test_dir"}, false, buff, testapp.CreateMockedApp(false), getter)
err := Run(
&RunFlags{LogFile: "/dev/null", NoCross: true},
[]string{"test_dir"},
false,
buff,
testapp.CreateMockedApp(false),
getter,
)

assert.Equal(t, "Error loading mount points: open /xxxyyy: no such file or directory", err.Error())
}
Expand All @@ -76,7 +117,13 @@ func TestListDevices(t *testing.T) {

buff := bytes.NewBuffer(make([]byte, 10))

Run(&RunFlags{LogFile: "/dev/null", ShowDisks: true}, nil, false, buff, testapp.CreateMockedApp(false), testdev.DevicesInfoGetterMock{})
Run(
&RunFlags{LogFile: "/dev/null", ShowDisks: true},
nil,
false,
buff,
testapp.CreateMockedApp(false), testdev.DevicesInfoGetterMock{},
)

assert.Contains(t, buff.String(), "Device")
}
Expand All @@ -88,7 +135,14 @@ func TestListDevicesWithErr(t *testing.T) {
buff := bytes.NewBuffer(make([]byte, 10))
getter := device.LinuxDevicesInfoGetter{MountsPath: "/xxxyyy"}

err := Run(&RunFlags{LogFile: "/dev/null", ShowDisks: true}, nil, false, buff, testapp.CreateMockedApp(false), getter)
err := Run(
&RunFlags{LogFile: "/dev/null", ShowDisks: true},
nil,
false,
buff,
testapp.CreateMockedApp(false),
getter,
)

assert.Equal(t, "Error loading mount points: open /xxxyyy: no such file or directory", err.Error())
}
Expand All @@ -99,5 +153,12 @@ func TestListDevicesWithGui(t *testing.T) {

buff := bytes.NewBuffer(make([]byte, 10))

Run(&RunFlags{LogFile: "/dev/null", ShowDisks: true}, nil, true, buff, testapp.CreateMockedApp(false), testdev.DevicesInfoGetterMock{})
Run(
&RunFlags{LogFile: "/dev/null", ShowDisks: true},
nil,
true,
buff,
testapp.CreateMockedApp(false),
testdev.DevicesInfoGetterMock{},
)
}

0 comments on commit 3fc16a1

Please sign in to comment.