Skip to content

Commit

Permalink
cmd/cue: add test case for embedded file error
Browse files Browse the repository at this point in the history
This adds a test case showing how the embed file
error positions are hidden. The fix will come in the
next CL.

For #3320

Signed-off-by: Roger Peppe <[email protected]>
Change-Id: I02625658c9b3783eb6bc84d7135ebf2069d9c48f
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198349
Unity-Result: CUE porcuepine <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
  • Loading branch information
rogpeppe committed Jul 29, 2024
1 parent dc199f5 commit bfcfff3
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions cmd/cue/cmd/testdata/script/embed_file_err.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Test what happens when there is an error an embedded file.
# TODO the error should mention the name of the file where the error is.

env CUE_EXPERIMENT=embed
! exec cue vet
cmp stderr want-stderr
! exec cue export
cmp stderr want-stderr
! exec cue def
cmp stderr want-stderr

-- want-stderr --
@embed: invalid string:
./x.cue:5:6
-- cue.mod/module.cue --
module: "test.example"
language: version: "v0.9.2"
-- x.cue --
@extern(embed)

package x

e: _ @embed(glob="*.json",type=jsonschema)

-- schema.json --
{
"$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false,
"id": "https://example.test/example",
"required": ["x"],
"title": "example jsonschema",
"type": "object",
"properties": {
"x": {
"description": true,
"type": "number"
}
}
}

0 comments on commit bfcfff3

Please sign in to comment.