@@ -40,7 +40,7 @@ var parentOperatorScenarios = []expressionScenario{
4040 },
4141 {
4242 description : "Get the top (root) parent" ,
43- subdescription : "Use negative numbers to get the top parents" ,
43+ subdescription : "Use negative numbers to get the top parents. You can think of this as indexing into the 'parents' array above " ,
4444 document : "a:\n b:\n c: cat\n " ,
4545 expression : `.a.b.c | parent(-1)` ,
4646 expected : []string {
@@ -56,15 +56,6 @@ var parentOperatorScenarios = []expressionScenario{
5656 "D0, P[], (!!map)::a:\n b:\n c: cat\n " ,
5757 },
5858 },
59- {
60- description : "N-th negative" ,
61- skipDoc : true ,
62- document : "a:\n b:\n c: cat\n " ,
63- expression : `.a.b.c | parent(-2)` ,
64- expected : []string {
65- "D0, P[a], (!!map)::b:\n c: cat\n " ,
66- },
67- },
6859 {
6960 description : "boundary negative" ,
7061 skipDoc : true ,
@@ -116,6 +107,15 @@ var parentOperatorScenarios = []expressionScenario{
116107 "D0, P[], (!!map)::a:\n b:\n c: cat\n " ,
117108 },
118109 },
110+ {
111+ description : "N-th negative" ,
112+ subdescription : "Similarly, use negative numbers to index backwards from the parents array" ,
113+ document : "a:\n b:\n c: cat\n " ,
114+ expression : `.a.b.c | parent(-2)` ,
115+ expected : []string {
116+ "D0, P[a], (!!map)::b:\n c: cat\n " ,
117+ },
118+ },
119119 {
120120 description : "No parent" ,
121121 document : `{}` ,
0 commit comments