"configs/rec/rec_icdar15_train.yml" did not exist on "55c28ed5b4d5d3482c7ad0bb5b8706eaf122a755"
locator_mock.go 1.64 KB
Newer Older
songlinfeng's avatar
songlinfeng committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq

package lookup

import (
	"sync"
)

// Ensure, that LocatorMock does implement Locator.
// If this is not the case, regenerate this file with moq.
var _ Locator = &LocatorMock{}

// LocatorMock is a mock implementation of Locator.
//
//	func TestSomethingThatUsesLocator(t *testing.T) {
//
//		// make and configure a mocked Locator
//		mockedLocator := &LocatorMock{
//			LocateFunc: func(s string) ([]string, error) {
//				panic("mock out the Locate method")
//			},
//		}
//
//		// use mockedLocator in code that requires Locator
//		// and then make assertions.
//
//	}
type LocatorMock struct {
	// LocateFunc mocks the Locate method.
	LocateFunc func(s string) ([]string, error)

	// calls tracks calls to the methods.
	calls struct {
		// Locate holds details about calls to the Locate method.
		Locate []struct {
			// S is the s argument value.
			S string
		}
	}
	lockLocate sync.RWMutex
}

// Locate calls LocateFunc.
func (mock *LocatorMock) Locate(s string) ([]string, error) {
	callInfo := struct {
		S string
	}{
		S: s,
	}
	mock.lockLocate.Lock()
	mock.calls.Locate = append(mock.calls.Locate, callInfo)
	mock.lockLocate.Unlock()
	if mock.LocateFunc == nil {
		var (
			stringsOut []string
			errOut     error
		)
		return stringsOut, errOut
	}
	return mock.LocateFunc(s)
}

// LocateCalls gets all the calls that were made to Locate.
// Check the length with:
//
//	len(mockedLocator.LocateCalls())
func (mock *LocatorMock) LocateCalls() []struct {
	S string
} {
	var calls []struct {
		S string
	}
	mock.lockLocate.RLock()
	calls = mock.calls.Locate
	mock.lockLocate.RUnlock()
	return calls
}