# Embedding at the file level should still close the package and validate
# correctly against files from other packages without first merging these
# files, thereby effectively embedding them and averting the closed check.

# Issue #743

! exec cue vet schema.cue foo.yaml
cmp stderr expect-foo

! exec cue vet schema.cue stream.yaml
cmp stderr expect-stream

-- schema.cue --
package schema

#Foo: {
    a: int
    b?: int
}
#Foo

-- foo.yaml --
a: 1
c: 2

-- stream.yaml --
a: 1
d: 2
---
a: 1
e: 2

-- expect-foo --
c: field not allowed:
    ./foo.yaml:2:1
-- expect-stream --
d: field not allowed:
    ./stream.yaml:2:1
