File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -178,3 +178,37 @@ func TestMakeCommentsWithMultipleModels(t *testing.T) {
178178 // Assert
179179 assert .Empty (t , err )
180180}
181+
182+ func TestMakeCommentsWithMultipleModelsByPointers (t * testing.T ) {
183+ type Ballot struct {
184+ //nolint
185+ tableName struct {} `pg:"ballots" pg-comment:"This multiple table name comment"`
186+ Ballot string `json:"ballot" pg-comment:"This is multiple field comment"`
187+ }
188+
189+ mockCtrl , mockSC , ctx := initMocks (t )
190+ defer mockCtrl .Finish ()
191+
192+ models := []interface {}{& Ballot {}, & Ballot {}, & Ballot {}}
193+
194+ // Assert prepare
195+ mockSC .
196+ EXPECT ().
197+ MakeTableComment (ctx , "ballots" , "This multiple table name comment" ).
198+ Times (3 ).
199+ Return (nil )
200+
201+ // Be aware: there is on issue with default order in checking
202+ // methods call: https://github.com/golang/mock/issues/653
203+ mockSC .
204+ EXPECT ().
205+ MakeColumnComment (ctx , "ballots" , "ballot" , "This is multiple field comment" ).
206+ Times (3 ).
207+ Return (nil )
208+
209+ // Act
210+ err := MakeComments (ctx , mockSC , models ... )
211+
212+ // Assert
213+ assert .Empty (t , err )
214+ }
You can’t perform that action at this time.
0 commit comments