Skip to content

Commit 72bc83c

Browse files
committed
Added test for partiall nil slices
1 parent 27f5669 commit 72bc83c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

results_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ func (s *RethinkSuite) TestRowsScanSlice(c *test.C) {
3535
c.Assert(response, JsonEquals, []interface{}{1, 2, 3, 4, 5})
3636
}
3737

38+
func (s *RethinkSuite) TestRowsPartiallyNilSlice(c *test.C) {
39+
row, err := Expr([]interface{}{
40+
map[string]interface{}{"num": 1},
41+
map[string]interface{}{"num": 2},
42+
nil,
43+
nil,
44+
map[string]interface{}{"num": 5},
45+
}).Run(sess)
46+
c.Assert(err, test.IsNil)
47+
48+
var response []interface{}
49+
err = row.ScanAll(&response)
50+
c.Assert(err, test.IsNil)
51+
c.Assert(response, JsonEquals, []interface{}{1, 2, nil, nil, 5})
52+
}
53+
3854
func (s *RethinkSuite) TestRowsScanMap(c *test.C) {
3955
row, err := Expr(map[string]interface{}{
4056
"id": 2,

0 commit comments

Comments
 (0)