#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:template", "template")

#@ def test1_left():
key1: val2
#@ end

#@ def test1_right():
key1: #@overlay/remove
#@ end

test1: #@ overlay.apply(test1_left(), test1_right())

---
#@ def test2_left():
- item1
#@ end

#@ def test2_right():
#@overlay/match by=overlay.index(0)
#@overlay/remove
-
#@ end

---
test2: #@ overlay.apply(test2_left(), test2_right())

---
#@ def test3_left():
---
"doc1"
---
"doc2"
#@ end

#@ def test3_right():
#@overlay/match by=overlay.subset("doc1")
#@overlay/remove
---
"doc1"
#@ end

--- #@ template.replace(overlay.apply(test3_left(), test3_right()))

+++

test1: {}
---
test2: []
---
doc2
