this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd/cue: add edge case tests for embed attributes

These exhibit behavior that changes with the next CL in this chain.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I226190ef6c477d2f2b0051c8be424ab2748ff335
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1233922
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Matthew Sackman <matthew@cue.works>

+103
+103
cmd/cue/cmd/testdata/script/embed_nonfield.txtar
··· 1 + cd $WORK/toplevel 2 + ! exec cue export 3 + cmp stdout want-stderr 4 + 5 + cd $WORK/toplevel_multi 6 + ! exec cue export 7 + cmp stderr want-stderr 8 + 9 + cd $WORK/inside_expr 10 + ! exec cue export 11 + cmp stderr want-stderr 12 + 13 + cd $WORK/field_multi 14 + ! exec cue export 15 + cmp stderr want-stderr 16 + 17 + cd $WORK/dynamic_field 18 + ! exec cue export 19 + cmp stdout want-stderr 20 + 21 + cd $WORK/pattern_field 22 + ! exec cue export 23 + cmp stdout want-stderr 24 + 25 + -- cue.mod/module.cue -- 26 + module: "cue.example" 27 + language: version: "v0.11.0" 28 + 29 + -- toplevel/want-stderr -- 30 + -- toplevel/x.cue -- 31 + @extern(embed) 32 + 33 + package toplevel 34 + @embed(file="x.json") 35 + -- toplevel/x.json -- 36 + {"x": true} 37 + 38 + -- toplevel_multi/want-stderr -- 39 + @embed attribute not associated with field: 40 + ./x.cue:3:1 41 + @embed attribute not associated with field: 42 + ./x.cue:4:1 43 + -- toplevel_multi/x.cue -- 44 + @extern(embed) 45 + package toplevel_multi 46 + @embed(file="x.json") 47 + @embed(file="y.json") 48 + -- toplevel_multi/x.json -- 49 + {"x": true} 50 + -- toplevel_multi/y.json -- 51 + {"y": true} 52 + 53 + -- inside_expr/want-stderr -- 54 + a: 2 errors in empty disjunction: 55 + a: conflicting values {x:true} and bool (mismatched types struct and bool): 56 + ./x.cue:3:4 57 + ./x.cue:4:17 58 + x.json:1:3 59 + a: conflicting values {x:true} and false (mismatched types struct and bool): 60 + ./x.cue:3:4 61 + ./x.cue:4:9 62 + x.json:1:3 63 + -- inside_expr/x.cue -- 64 + @extern(embed) 65 + package inside_expr 66 + a: { 67 + x: *false | bool 68 + @embed(file=x.json) 69 + }.x 70 + -- inside_expr/x.json -- 71 + {"x": true} 72 + 73 + -- field_multi/want-stderr -- 74 + duplicate @embed attributes: 75 + ./x.cue:3:26 76 + -- field_multi/x.cue -- 77 + @extern(embed) 78 + package field_multi 79 + a: _ @embed(file=x.json) @embed(file=y.json) 80 + -- field_multi/x.json -- 81 + {"x": true} 82 + -- field_multi/y.json -- 83 + {"y": true} 84 + 85 + -- dynamic_field/want-stderr -- 86 + -- dynamic_field/x.cue -- 87 + @extern(embed) 88 + package dynamic_field 89 + 90 + a: "foo" 91 + (a): _ @embed(file=x.json) 92 + -- dynamic_field/x.json -- 93 + {"a": true} 94 + 95 + -- pattern_field/want-stderr -- 96 + -- pattern_field/x.cue -- 97 + @extern(embed) 98 + package dynamic_field 99 + 100 + [_]: _ @embed(file=x.json) 101 + x: _ 102 + -- pattern_field/x.json -- 103 + {"a": true}