Skip to content

Commit bfcfff3

Browse files
committed
cmd/cue: add test case for embedded file error
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]>
1 parent dc199f5 commit bfcfff3

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Test what happens when there is an error an embedded file.
2+
# TODO the error should mention the name of the file where the error is.
3+
4+
env CUE_EXPERIMENT=embed
5+
! exec cue vet
6+
cmp stderr want-stderr
7+
! exec cue export
8+
cmp stderr want-stderr
9+
! exec cue def
10+
cmp stderr want-stderr
11+
12+
-- want-stderr --
13+
@embed: invalid string:
14+
./x.cue:5:6
15+
-- cue.mod/module.cue --
16+
module: "test.example"
17+
language: version: "v0.9.2"
18+
-- x.cue --
19+
@extern(embed)
20+
21+
package x
22+
23+
e: _ @embed(glob="*.json",type=jsonschema)
24+
25+
-- schema.json --
26+
{
27+
"$schema": "http://json-schema.org/draft-04/schema#",
28+
"additionalProperties": false,
29+
"id": "https://example.test/example",
30+
"required": ["x"],
31+
"title": "example jsonschema",
32+
"type": "object",
33+
"properties": {
34+
"x": {
35+
"description": true,
36+
"type": "number"
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)