cli/pkg/extensions/extension_mock.go
Mislav Marohnić 1ec47d8191 Improvements to gh extensions
- Extensions on Windows now enabled through the `sh.exe` interpreter
- `sh.exe` now found on Windows when git was installed via scoop
- `gh extensions list` command shows origin repo for the extension
- `gh extensions upgrade --all` is required to upgrade all extensions
- Added `gh extensions remove`
- Shell completions now include aliases and extension names
- `gh` help output now lists available extension names
- Extensions are stored to XDG_DATA_HOME
2021-06-21 16:54:08 +02:00

138 lines
3.2 KiB
Go

// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package extensions
import (
"sync"
)
// Ensure, that ExtensionMock does implement Extension.
// If this is not the case, regenerate this file with moq.
var _ Extension = &ExtensionMock{}
// ExtensionMock is a mock implementation of Extension.
//
// func TestSomethingThatUsesExtension(t *testing.T) {
//
// // make and configure a mocked Extension
// mockedExtension := &ExtensionMock{
// NameFunc: func() string {
// panic("mock out the Name method")
// },
// PathFunc: func() string {
// panic("mock out the Path method")
// },
// URLFunc: func() string {
// panic("mock out the URL method")
// },
// }
//
// // use mockedExtension in code that requires Extension
// // and then make assertions.
//
// }
type ExtensionMock struct {
// NameFunc mocks the Name method.
NameFunc func() string
// PathFunc mocks the Path method.
PathFunc func() string
// URLFunc mocks the URL method.
URLFunc func() string
// calls tracks calls to the methods.
calls struct {
// Name holds details about calls to the Name method.
Name []struct {
}
// Path holds details about calls to the Path method.
Path []struct {
}
// URL holds details about calls to the URL method.
URL []struct {
}
}
lockName sync.RWMutex
lockPath sync.RWMutex
lockURL sync.RWMutex
}
// Name calls NameFunc.
func (mock *ExtensionMock) Name() string {
if mock.NameFunc == nil {
panic("ExtensionMock.NameFunc: method is nil but Extension.Name was just called")
}
callInfo := struct {
}{}
mock.lockName.Lock()
mock.calls.Name = append(mock.calls.Name, callInfo)
mock.lockName.Unlock()
return mock.NameFunc()
}
// NameCalls gets all the calls that were made to Name.
// Check the length with:
// len(mockedExtension.NameCalls())
func (mock *ExtensionMock) NameCalls() []struct {
} {
var calls []struct {
}
mock.lockName.RLock()
calls = mock.calls.Name
mock.lockName.RUnlock()
return calls
}
// Path calls PathFunc.
func (mock *ExtensionMock) Path() string {
if mock.PathFunc == nil {
panic("ExtensionMock.PathFunc: method is nil but Extension.Path was just called")
}
callInfo := struct {
}{}
mock.lockPath.Lock()
mock.calls.Path = append(mock.calls.Path, callInfo)
mock.lockPath.Unlock()
return mock.PathFunc()
}
// PathCalls gets all the calls that were made to Path.
// Check the length with:
// len(mockedExtension.PathCalls())
func (mock *ExtensionMock) PathCalls() []struct {
} {
var calls []struct {
}
mock.lockPath.RLock()
calls = mock.calls.Path
mock.lockPath.RUnlock()
return calls
}
// URL calls URLFunc.
func (mock *ExtensionMock) URL() string {
if mock.URLFunc == nil {
panic("ExtensionMock.URLFunc: method is nil but Extension.URL was just called")
}
callInfo := struct {
}{}
mock.lockURL.Lock()
mock.calls.URL = append(mock.calls.URL, callInfo)
mock.lockURL.Unlock()
return mock.URLFunc()
}
// URLCalls gets all the calls that were made to URL.
// Check the length with:
// len(mockedExtension.URLCalls())
func (mock *ExtensionMock) URLCalls() []struct {
} {
var calls []struct {
}
mock.lockURL.RLock()
calls = mock.calls.URL
mock.lockURL.RUnlock()
return calls
}