Closed JosiahWitt closed 3 years ago
Integrates with gomock.
For example:
type Mocks struct { DB *mock_db.MockDB // Generated by gomock } table := []struct { Name string Input string IsEmpty bool Mocks *Mocks SetupMocks func(*Mocks) }{ { Name: "with non empty input", Input: "my string", IsEmpty: false, SetupMocks: func(mocks *Mocks) { mocks.DB.EXPECT().Set("my-key", "my value") }, }, { Name: "with empty input", Input: "", IsEmpty: true, }, } ensure.RunTableByIndex(table, func(ensure Ensure, i int) { entry := table[i] // entry.Mocks.DB is ready for use here isEmpty := strs.IsEmpty(entry.Input) ensure(isEmpty).Equals(entry.IsEmpty) })
Integrates with gomock.
For example: