mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-13 11:55:38 +00:00
Fix #1
This commit is contained in:
parent
7ef556f22b
commit
2a283b4ef7
@ -58,7 +58,7 @@ func recurse(value interface{}, head string, tail []string) interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func readArray(array []interface{}, head int64, tail []string) interface{} {
|
func readArray(array []interface{}, head int64, tail []string) interface{} {
|
||||||
if head > int64(len(array)) {
|
if head >= int64(len(array)) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,17 @@ b:
|
|||||||
assertResult(t, nil, readMap(data, "b", []string{"d", "3"}))
|
assertResult(t, nil, readMap(data, "b", []string{"d", "3"}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestReadMap_with_array_out_of_bounds_by_1(t *testing.T) {
|
||||||
|
var data = parseData(`
|
||||||
|
---
|
||||||
|
b:
|
||||||
|
d:
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
`)
|
||||||
|
assertResult(t, nil, readMap(data, "b", []string{"d", "2"}))
|
||||||
|
}
|
||||||
|
|
||||||
func TestReadMap_with_array_splat(t *testing.T) {
|
func TestReadMap_with_array_splat(t *testing.T) {
|
||||||
var data = parseData(`
|
var data = parseData(`
|
||||||
e:
|
e:
|
||||||
|
Loading…
Reference in New Issue
Block a user