Skip to content

Commit

Permalink
cue: add test for embedded file not in a module
Browse files Browse the repository at this point in the history
This adds a test that will be fixed in the next CL.

For #3530

Signed-off-by: Roger Peppe <[email protected]>
Change-Id: I6cfbe49913cea0fa433208def32e9fab2ed85c75
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1203263
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
  • Loading branch information
rogpeppe committed Oct 29, 2024
1 parent 8b2affe commit 06d0c73
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cue/embed_test.go
Original file line number Diff line number Diff line change
@@ -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`))
}

0 comments on commit 06d0c73

Please sign in to comment.