github.com/stretchr/testify
Advanced tools
| //go:build testify_no_objx || testify_no_deps | ||
| package mock | ||
| type testData = struct{} |
| //go:build !testify_no_objx && !testify_no_deps | ||
| package mock | ||
| import ( | ||
| "testing" | ||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
| func Test_Mock_TestData(t *testing.T) { | ||
| t.Parallel() | ||
| var mockedService = new(TestExampleImplementation) | ||
| if assert.NotNil(t, mockedService.TestData()) { | ||
| mockedService.TestData().Set("something", 123) | ||
| assert.Equal(t, 123, mockedService.TestData().Get("something").Data()) | ||
| } | ||
| } |
| // This source file isolates the uses of the objx module to ease | ||
| // maintenance of downstream forks that remove that dependency. | ||
| // See https://github.com/stretchr/testify/issues/1752 | ||
| //go:build !testify_no_objx && !testify_no_deps | ||
| package mock | ||
| import "github.com/stretchr/objx" | ||
| type testData = objx.Map | ||
| // TestData holds any data that might be useful for testing. Testify ignores | ||
| // this data completely allowing you to do whatever you like with it. | ||
| func (m *Mock) TestData() objx.Map { | ||
| if m.testData == nil { | ||
| m.testData = make(objx.Map) | ||
| } | ||
| return m.testData | ||
| } |
+1
-12
@@ -16,3 +16,2 @@ package mock | ||
| "github.com/pmezard/go-difflib/difflib" | ||
| "github.com/stretchr/objx" | ||
@@ -315,3 +314,3 @@ "github.com/stretchr/testify/assert" | ||
| // this data completely allowing you to do whatever you like with it. | ||
| testData objx.Map | ||
| testData testData | ||
@@ -329,12 +328,2 @@ mutex sync.Mutex | ||
| // TestData holds any data that might be useful for testing. Testify ignores | ||
| // this data completely allowing you to do whatever you like with it. | ||
| func (m *Mock) TestData() objx.Map { | ||
| if m.testData == nil { | ||
| m.testData = make(objx.Map) | ||
| } | ||
| return m.testData | ||
| } | ||
| /* | ||
@@ -341,0 +330,0 @@ Setting expectations |
Sorry, the diff of this file is too big to display