# 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

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

! 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 --
field not allowed: c:
    ./foo.yaml:2:2
    ./schema.cue:1:1
    ./schema.cue:3:7
    ./schema.cue:7:1
-- expect-stream --
field not allowed: d:
    ./schema.cue:1:1
    ./schema.cue:3:7
    ./schema.cue:7:1
    ./stream.yaml:2:2
-- expect-stream --
field not allowed: d:
    ./schema.cue:1:1
    ./schema.cue:3:7
    ./schema.cue:7:1
    ./stream.yaml:2:2
