cd $WORK/toplevel
exec cue export
cmp stdout want-stdout

cd $WORK/toplevel_multi
exec cue export
cmp stdout want-stdout

cd $WORK/inside_expr
exec cue export
cmp stdout want-stdout

cd $WORK/field_multi
exec cue export
cmp stdout want-stdout

cd $WORK/dynamic_field
exec cue export
cmp stdout want-stdout

cd $WORK/pattern_field
exec cue export
cmp stdout want-stdout

-- cue.mod/module.cue --
module: "cue.example"
language: version: "v0.11.0"

-- toplevel/want-stdout --
{
    "x": true
}
-- toplevel/x.cue --
@extern(embed)

package toplevel
@embed(file="x.json")
-- toplevel/x.json --
{"x": true}

-- toplevel_multi/want-stdout --
{
    "x": true,
    "y": true
}
-- toplevel_multi/x.cue --
@extern(embed)
package toplevel_multi
@embed(file="x.json")
@embed(file="y.json")
-- toplevel_multi/x.json --
{"x": true}
-- toplevel_multi/y.json --
{"y": true}

-- inside_expr/want-stdout --
{
    "a": true
}
-- inside_expr/x.cue --
@extern(embed)
package inside_expr
a: {
    x: *false | bool
    @embed(file=x.json)
}.x
-- inside_expr/x.json --
{"x": true}

-- field_multi/want-stdout --
{
    "a": {
        "x": true,
        "y": true
    }
}
-- field_multi/x.cue --
@extern(embed)
package field_multi
a: _ @embed(file=x.json) @embed(file=y.json)
-- field_multi/x.json --
{"x": true}
-- field_multi/y.json --
{"y": true}

-- dynamic_field/want-stdout --
{
    "a": "foo",
    "foo": {
        "a": true
    }
}
-- dynamic_field/x.cue --
@extern(embed)
package dynamic_field

a: "foo"
(a): _ @embed(file=x.json)
-- dynamic_field/x.json --
{"a": true}

-- pattern_field/want-stdout --
{
    "x": {
        "a": true
    }
}
-- pattern_field/x.cue --
@extern(embed)
package dynamic_field

[_]: _ @embed(file=x.json)
x: _
-- pattern_field/x.json --
{"a": true}
