diff --git a/cue/embed_test.go b/cue/embed_test.go new file mode 100644 index 00000000000..e5b5f96fdea --- /dev/null +++ b/cue/embed_test.go @@ -0,0 +1,21 @@ +package cue_test + +import ( + "testing" + + "cuelang.org/go/cue/cuecontext" + "cuelang.org/go/cue/interpreter/embed" + "github.com/go-quicktest/qt" +) + +func TestEmbedFailsWhenNotInModule(t *testing.T) { + ctx := cuecontext.New(cuecontext.Interpreter(embed.New())) + v := ctx.CompileString(` +@extern(embed) + +package foo +x: _ @embed(file="testdata/readme.md",type=text) +`) + qt.Assert(t, qt.IsNil(v.Err())) + // TODO qt.Assert(t, qt.ErrorMatches(v.Err(), `xxx`)) +}