Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Simple fix to result object to return defaultrs
Browse files Browse the repository at this point in the history
  • Loading branch information
yuce committed Sep 20, 2017
1 parent d4a5ac8 commit a526e91
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
34 changes: 34 additions & 0 deletions client_it_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,40 @@ func TestClientReturnsResponse(t *testing.T) {
}
}

func TestResponseDefaults(t *testing.T) {
assertResult := func(r *QueryResult) {
if r.Bitmap == nil {
t.Fatalf("Default should be set for bitmap result")
}
if r.CountItems == nil {
t.Fatalf("CountItems should be set for bitmap result")
}
}

client := getClient()

frame, _ := index.Frame("defaults-frame", nil)
err := client.CreateFrame(frame)
if err != nil {
t.Fatal(err)
}

response, err := client.Query(frame.TopN(5), nil)
if err != nil {
t.Fatal(err)
}
result := response.Result()
assertResult(result)

response, err = client.Query(frame.Bitmap(99999), nil)
if err != nil {
t.Fatal(err)
}
result = response.Result()
assertResult(result)

}

func TestQueryWithColumns(t *testing.T) {
Reset()
client := getClient()
Expand Down
2 changes: 2 additions & 0 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ func newQueryResultFromInternal(result *internal.QueryResult) (*QueryResult, err
if err != nil {
return nil, err
}
} else {
bitmapResult = &BitmapResult{}
}
if result.SumCount != nil {
sum = result.SumCount.Sum
Expand Down

0 comments on commit a526e91

Please sign in to comment.