summaryrefslogtreecommitdiffstats
path: root/pkg/commands/os_test.go
diff options
context:
space:
mode:
authorAnthony HAMON <anthony.hamon@iadvize.com>2018-08-22 22:30:02 +0200
committerAnthony HAMON <anthony.hamon@iadvize.com>2018-08-26 01:58:19 +0200
commit38f11f1f4a9df758a7ff030247a171711dca2339 (patch)
tree538e7ed8e7516ed3af323f0bde0ea69870e1951d /pkg/commands/os_test.go
parentf91e2b12dbc02e3dc05f5ae746d16a702ba57c27 (diff)
move dummy functions, rename functions
Diffstat (limited to 'pkg/commands/os_test.go')
-rw-r--r--pkg/commands/os_test.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/pkg/commands/os_test.go b/pkg/commands/os_test.go
index 128caa1b2..9d5cc1354 100644
--- a/pkg/commands/os_test.go
+++ b/pkg/commands/os_test.go
@@ -3,12 +3,14 @@ package commands
import (
"testing"
- "github.com/Sirupsen/logrus"
-
"github.com/stretchr/testify/assert"
)
-func TestRunCommandWithOutput(t *testing.T) {
+func newDummyOSCommand() *OSCommand {
+ return NewOSCommand(newDummyLog())
+}
+
+func TestOSCommandRunCommandWithOutput(t *testing.T) {
type scenario struct {
command string
test func(string, error)
@@ -31,11 +33,11 @@ func TestRunCommandWithOutput(t *testing.T) {
}
for _, s := range scenarios {
- s.test(NewOSCommand(logrus.New()).RunCommandWithOutput(s.command))
+ s.test(newDummyOSCommand().RunCommandWithOutput(s.command))
}
}
-func TestRunCommand(t *testing.T) {
+func TestOSCommandRunCommand(t *testing.T) {
type scenario struct {
command string
test func(error)
@@ -51,12 +53,12 @@ func TestRunCommand(t *testing.T) {
}
for _, s := range scenarios {
- s.test(NewOSCommand(logrus.New()).RunCommand(s.command))
+ s.test(newDummyOSCommand().RunCommand(s.command))
}
}
-func TestQuote(t *testing.T) {
- osCommand := NewOSCommand(logrus.New())
+func TestOSCommandQuote(t *testing.T) {
+ osCommand := newDummyOSCommand()
actual := osCommand.Quote("hello `test`")
@@ -65,8 +67,8 @@ func TestQuote(t *testing.T) {
assert.EqualValues(t, expected, actual)
}
-func TestUnquote(t *testing.T) {
- osCommand := NewOSCommand(logrus.New())
+func TestOSCommandUnquote(t *testing.T) {
+ osCommand := newDummyOSCommand()
actual := osCommand.Unquote(`hello "test"`)