vendor tsgo
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
// Code generated by moq; DO NOT EDIT.
|
||||
// github.com/matryer/moq
|
||||
|
||||
package projecttestutil
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/project/ata"
|
||||
)
|
||||
|
||||
// Ensure, that NpmExecutorMock does implement ata.NpmExecutor.
|
||||
// If this is not the case, regenerate this file with moq.
|
||||
var _ ata.NpmExecutor = &NpmExecutorMock{}
|
||||
|
||||
// NpmExecutorMock is a mock implementation of ata.NpmExecutor.
|
||||
//
|
||||
// func TestSomethingThatUsesNpmExecutor(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked ata.NpmExecutor
|
||||
// mockedNpmExecutor := &NpmExecutorMock{
|
||||
// NpmInstallFunc: func(cwd string, args []string) ([]byte, error) {
|
||||
// panic("mock out the NpmInstall method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedNpmExecutor in code that requires ata.NpmExecutor
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
type NpmExecutorMock struct {
|
||||
// NpmInstallFunc mocks the NpmInstall method.
|
||||
NpmInstallFunc func(cwd string, args []string) ([]byte, error)
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// NpmInstall holds details about calls to the NpmInstall method.
|
||||
NpmInstall []struct {
|
||||
// Cwd is the cwd argument value.
|
||||
Cwd string
|
||||
// Args is the args argument value.
|
||||
Args []string
|
||||
}
|
||||
}
|
||||
lockNpmInstall sync.RWMutex
|
||||
}
|
||||
|
||||
// NpmInstall calls NpmInstallFunc.
|
||||
func (mock *NpmExecutorMock) NpmInstall(cwd string, args []string) ([]byte, error) {
|
||||
callInfo := struct {
|
||||
Cwd string
|
||||
Args []string
|
||||
}{
|
||||
Cwd: cwd,
|
||||
Args: args,
|
||||
}
|
||||
mock.lockNpmInstall.Lock()
|
||||
mock.calls.NpmInstall = append(mock.calls.NpmInstall, callInfo)
|
||||
mock.lockNpmInstall.Unlock()
|
||||
if mock.NpmInstallFunc == nil {
|
||||
var (
|
||||
bytesOut []byte
|
||||
errOut error
|
||||
)
|
||||
return bytesOut, errOut
|
||||
}
|
||||
return mock.NpmInstallFunc(cwd, args)
|
||||
}
|
||||
|
||||
// NpmInstallCalls gets all the calls that were made to NpmInstall.
|
||||
// Check the length with:
|
||||
//
|
||||
// len(mockedNpmExecutor.NpmInstallCalls())
|
||||
func (mock *NpmExecutorMock) NpmInstallCalls() []struct {
|
||||
Cwd string
|
||||
Args []string
|
||||
} {
|
||||
var calls []struct {
|
||||
Cwd string
|
||||
Args []string
|
||||
}
|
||||
mock.lockNpmInstall.RLock()
|
||||
calls = mock.calls.NpmInstall
|
||||
mock.lockNpmInstall.RUnlock()
|
||||
return calls
|
||||
}
|
||||
Reference in New Issue
Block a user