@@ -29,10 +29,28 @@ func TestIntegration(t *testing.T) {
29
29
30
30
testCases := []struct {
31
31
query string
32
- result [][] interface {}
32
+ result []sql. Row
33
33
}{
34
- // TODO: add tests
35
- // {"SELECT 1 FROM repositories", [][]interface{}{{int64(1)}}},
34
+ {
35
+ `SELECT COUNT(c.hash), c.hash
36
+ FROM refs r
37
+ INNER JOIN commits c
38
+ ON history_idx(r.hash, c.hash) >= 0
39
+ INNER JOIN blobs b
40
+ ON commit_contains(c.hash, b.hash)
41
+ WHERE r.name = 'refs/heads/master'
42
+ GROUP BY c.hash` ,
43
+ []sql.Row {
44
+ {int32 (4 ), "1669dce138d9b841a518c64b10914d88f5e488ea" },
45
+ {int32 (3 ), "35e85108805c84807bc66a02d91535e1e24b38b9" },
46
+ {int32 (9 ), "6ecf0ef2c2dffb796033e5a02219af86ec6584e5" },
47
+ {int32 (8 ), "918c48b83bd081e863dbe1b80f8998f058cd8294" },
48
+ {int32 (3 ), "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69" },
49
+ {int32 (6 ), "af2d6a6954d532f8ffb47615169c8fdf9d383a1a" },
50
+ {int32 (2 ), "b029517f6300c2da0f4b651b8642506cd6aaf45d" },
51
+ {int32 (3 ), "b8e471f58bcbca63b07bda20e428190409c2db47" },
52
+ },
53
+ },
36
54
}
37
55
38
56
for _ , tt := range testCases {
@@ -43,7 +61,7 @@ func TestIntegration(t *testing.T) {
43
61
require .NoError (err )
44
62
rows , err := sql .RowIterToRows (iter )
45
63
require .NoError (err )
46
- require .Equal (tt .result , rows )
64
+ require .ElementsMatch (tt .result , rows )
47
65
})
48
66
}
49
67
}
0 commit comments