Fix #52: query matcher doesn't handle arrays tables

Also improve coverage of query matcher.
This commit is contained in:
Thomas Pelletier
2016-03-16 09:56:04 -07:00
parent fe63e9f76d
commit d6a90e60ed
4 changed files with 99 additions and 2 deletions
+10 -1
View File
@@ -29,7 +29,16 @@ func (r *QueryResult) appendResult(node interface{}, pos Position) {
// Set of values within a QueryResult. The order of values is not guaranteed
// to be in document order, and may be different each time a query is executed.
func (r *QueryResult) Values() []interface{} {
return r.items
values := make([]interface{}, len(r.items))
for i, v := range r.items {
o, ok := v.(*tomlValue)
if ok {
values[i] = o.value
} else {
values[i] = v
}
}
return values
}
// Set of positions for values within a QueryResult. Each index in Positions()