github.com/ktr0731/dept@v0.1.4-0.20191208040738-06ee3ca97c03/deptfile/mock_gen.go (about)

     1  // Code generated by moq; DO NOT EDIT.
     2  // github.com/matryer/moq
     3  
     4  package deptfile
     5  
     6  import (
     7  	"sync"
     8  )
     9  
    10  var (
    11  	lockWorkspacerMockDo sync.RWMutex
    12  )
    13  
    14  // WorkspacerMock is a mock implementation of Workspacer.
    15  //
    16  //     func TestSomethingThatUsesWorkspacer(t *testing.T) {
    17  //
    18  //         // make and configure a mocked Workspacer
    19  //         mockedWorkspacer := &WorkspacerMock{
    20  //             DoFunc: func(f func(projectDir string, gomod *File) error) error {
    21  // 	               panic("mock out the Do method")
    22  //             },
    23  //         }
    24  //
    25  //         // use mockedWorkspacer in code that requires Workspacer
    26  //         // and then make assertions.
    27  //
    28  //     }
    29  type WorkspacerMock struct {
    30  	// DoFunc mocks the Do method.
    31  	DoFunc func(f func(projectDir string, gomod *File) error) error
    32  
    33  	// calls tracks calls to the methods.
    34  	calls struct {
    35  		// Do holds details about calls to the Do method.
    36  		Do []struct {
    37  			// F is the f argument value.
    38  			F func(projectDir string, gomod *File) error
    39  		}
    40  	}
    41  }
    42  
    43  // Do calls DoFunc.
    44  func (mock *WorkspacerMock) Do(f func(projectDir string, gomod *File) error) error {
    45  	if mock.DoFunc == nil {
    46  		panic("WorkspacerMock.DoFunc: method is nil but Workspacer.Do was just called")
    47  	}
    48  	callInfo := struct {
    49  		F func(projectDir string, gomod *File) error
    50  	}{
    51  		F: f,
    52  	}
    53  	lockWorkspacerMockDo.Lock()
    54  	mock.calls.Do = append(mock.calls.Do, callInfo)
    55  	lockWorkspacerMockDo.Unlock()
    56  	return mock.DoFunc(f)
    57  }
    58  
    59  // DoCalls gets all the calls that were made to Do.
    60  // Check the length with:
    61  //     len(mockedWorkspacer.DoCalls())
    62  func (mock *WorkspacerMock) DoCalls() []struct {
    63  	F func(projectDir string, gomod *File) error
    64  } {
    65  	var calls []struct {
    66  		F func(projectDir string, gomod *File) error
    67  	}
    68  	lockWorkspacerMockDo.RLock()
    69  	calls = mock.calls.Do
    70  	lockWorkspacerMockDo.RUnlock()
    71  	return calls
    72  }