@@ -111,3 +111,96 @@ func TestCommitsPushdown(t *testing.T) {
111
111
require .NoError (err )
112
112
require .Len (rows , 1 )
113
113
}
114
+
115
+ func TestCommitsParents (t * testing.T ) {
116
+ session , _ , cleanup := setup (t )
117
+ defer cleanup ()
118
+
119
+ table := newCommitsTable ()
120
+ iter , err := table .RowIter (session )
121
+ require .NoError (t , err )
122
+
123
+ rows , err := sql .RowIterToRows (iter )
124
+ require .NoError (t , err )
125
+ require .Len (t , rows , 9 )
126
+
127
+ tests := []struct {
128
+ name string
129
+ hash string
130
+ parents []string
131
+ }{
132
+ {
133
+ name : "test commits parents 1" ,
134
+ hash : "e8d3ffab552895c19b9fcf7aa264d277cde33881" ,
135
+ parents : []string {
136
+ "918c48b83bd081e863dbe1b80f8998f058cd8294" ,
137
+ },
138
+ },
139
+ {
140
+ name : "test commits parents 2" ,
141
+ hash : "6ecf0ef2c2dffb796033e5a02219af86ec6584e5" ,
142
+ parents : []string {
143
+ "918c48b83bd081e863dbe1b80f8998f058cd8294" ,
144
+ },
145
+ },
146
+ {
147
+ name : "test commits parents 3" ,
148
+ hash : "918c48b83bd081e863dbe1b80f8998f058cd8294" ,
149
+ parents : []string {
150
+ "af2d6a6954d532f8ffb47615169c8fdf9d383a1a" ,
151
+ },
152
+ },
153
+ {
154
+ name : "test commits parents 4" ,
155
+ hash : "af2d6a6954d532f8ffb47615169c8fdf9d383a1a" ,
156
+ parents : []string {
157
+ "1669dce138d9b841a518c64b10914d88f5e488ea" ,
158
+ },
159
+ },
160
+ {
161
+ name : "test commits parents 5" ,
162
+ hash : "1669dce138d9b841a518c64b10914d88f5e488ea" ,
163
+ parents : []string {
164
+ "35e85108805c84807bc66a02d91535e1e24b38b9" ,
165
+ "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69" ,
166
+ },
167
+ },
168
+ {
169
+ name : "test commits parents 6" ,
170
+ hash : "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69" ,
171
+ parents : []string {
172
+ "b029517f6300c2da0f4b651b8642506cd6aaf45d" ,
173
+ "b8e471f58bcbca63b07bda20e428190409c2db47" ,
174
+ },
175
+ },
176
+ {
177
+ name : "test commits parents 7" ,
178
+ hash : "b8e471f58bcbca63b07bda20e428190409c2db47" ,
179
+ parents : []string {
180
+ "b029517f6300c2da0f4b651b8642506cd6aaf45d" ,
181
+ },
182
+ },
183
+ {
184
+ name : "test commits parents 8" ,
185
+ hash : "35e85108805c84807bc66a02d91535e1e24b38b9" ,
186
+ parents : []string {
187
+ "b029517f6300c2da0f4b651b8642506cd6aaf45d" ,
188
+ },
189
+ },
190
+ {
191
+ name : "test commits parents 9" ,
192
+ hash : "b029517f6300c2da0f4b651b8642506cd6aaf45d" ,
193
+ parents : []string {},
194
+ },
195
+ }
196
+
197
+ for i , test := range tests {
198
+ t .Run (test .name , func (t * testing.T ) {
199
+ hash := rows [i ][0 ]
200
+ parents := rows [i ][9 ]
201
+ require .Equal (t , test .hash , hash )
202
+ require .ElementsMatch (t , test .parents , parents )
203
+ })
204
+ }
205
+
206
+ }
0 commit comments