mirror of
				https://github.com/taigrr/yq
				synced 2025-01-18 04:53:17 -08:00 
			
		
		
		
	Fixed collect at document level
This commit is contained in:
		
							parent
							
								
									369ff94ad0
								
							
						
					
					
						commit
						e4d48bbc0d
					
				| @ -29,7 +29,7 @@ func CollectOperator(d *dataTreeNavigator, matchMap *list.List, pathNode *PathTr | ||||
| 			path = candidate.Path[:len(candidate.Path)-1] | ||||
| 			document = candidate.Document | ||||
| 		} | ||||
| 		node.Content = append(node.Content, candidate.Node) | ||||
| 		node.Content = append(node.Content, UnwrapDoc(candidate.Node)) | ||||
| 	} | ||||
| 
 | ||||
| 	collectC := &CandidateNode{Node: node, Document: document, Path: path} | ||||
|  | ||||
| @ -13,6 +13,15 @@ var collectOperatorScenarios = []expressionScenario{ | ||||
| 			"D0, P[], (!!seq)::[]\n", | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		skipDoc: true, | ||||
| 		document:    "{a: apple}\n---\n{b: frog}", | ||||
| 		 | ||||
| 		expression:  `[.]`, | ||||
| 		expected: []string{ | ||||
| 			"D0, P[], (!!seq)::- {a: apple}\n- {b: frog}\n", | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		skipDoc:    true, | ||||
| 		document:   ``, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user