From: Andrew Sichevoi Date: Tue, 15 May 2018 10:12:16 +0000 (+0300) Subject: ref: fix naming of test's supplementary files X-Git-Url: http://git.thekondor.net/?a=commitdiff_plain;h=292ae3f03d7feefe50a5bb7b416f2bebf96dd891;p=git-purged.git ref: fix naming of test's supplementary files --- diff --git a/src/git_purged/git_helpers_test.go b/src/git_purged/git_helpers_test.go new file mode 100644 index 0000000..c3a2263 --- /dev/null +++ b/src/git_purged/git_helpers_test.go @@ -0,0 +1,33 @@ +// This file is a part of 'git-purged' tool, http://thekondor.net + +package git_purged + +import ( + "github.com/stretchr/testify/mock" +) + +func arrayOfStrings(args mock.Arguments, index int) []string { + arg := args.Get(0) + arrayOfString, ok := arg.([]string) + if !ok { + panic("Cannot cast to array of strings") + } + + return arrayOfString +} + +var EmptyStdOut = []string{} +var EmptyError error = nil + +func withArgs(args ...string) []string { + return args +} + +func stdOut(args ...string) []string { + return args +} + +func anyArgument(interface{}) bool { + return true +} + diff --git a/src/git_purged/git_mock_test.go b/src/git_purged/git_mock_test.go new file mode 100644 index 0000000..e9426a2 --- /dev/null +++ b/src/git_purged/git_mock_test.go @@ -0,0 +1,17 @@ +// This file is a part of 'git-purged' tool, http://thekondor.net + +package git_purged + +import ( + "github.com/stretchr/testify/mock" +) + +type GitExternalCommandMock struct { + mock.Mock +} + +func (self *GitExternalCommandMock) Run(args ...string) ([]string, error) { + mockArgs := self.Called(args) + return arrayOfStrings(mockArgs, 0), mockArgs.Error(1) +} + diff --git a/src/git_purged/git_test-helpers.go b/src/git_purged/git_test-helpers.go deleted file mode 100644 index c3a2263..0000000 --- a/src/git_purged/git_test-helpers.go +++ /dev/null @@ -1,33 +0,0 @@ -// This file is a part of 'git-purged' tool, http://thekondor.net - -package git_purged - -import ( - "github.com/stretchr/testify/mock" -) - -func arrayOfStrings(args mock.Arguments, index int) []string { - arg := args.Get(0) - arrayOfString, ok := arg.([]string) - if !ok { - panic("Cannot cast to array of strings") - } - - return arrayOfString -} - -var EmptyStdOut = []string{} -var EmptyError error = nil - -func withArgs(args ...string) []string { - return args -} - -func stdOut(args ...string) []string { - return args -} - -func anyArgument(interface{}) bool { - return true -} - diff --git a/src/git_purged/git_test-mock.go b/src/git_purged/git_test-mock.go deleted file mode 100644 index e9426a2..0000000 --- a/src/git_purged/git_test-mock.go +++ /dev/null @@ -1,17 +0,0 @@ -// This file is a part of 'git-purged' tool, http://thekondor.net - -package git_purged - -import ( - "github.com/stretchr/testify/mock" -) - -type GitExternalCommandMock struct { - mock.Mock -} - -func (self *GitExternalCommandMock) Run(args ...string) ([]string, error) { - mockArgs := self.Called(args) - return arrayOfStrings(mockArgs, 0), mockArgs.Error(1) -} -